Wednesday, November 30, 2005

FoxPro Tips: Class Browser

At the recent German DevCon I presented my "Get Productive with Visual FoxPro" session. This session is always different each time I give it. Mostly because the people attending the session often participate by throwing in their own productivity tips (which I encourage in all my sessions). I always start the session off with productivity tips with the Class Browser tool which ships with VFP (and has since VFP 3). It rarely fails that a developer will contact me after the session to let me know how much they appreciate the various tips on the Class Browser.

So in case you have not seen the session, here are some of the tips:

Set the default file to be opened when Class Browser is started

First open up the Class Browser and open up the class library you want to be the default class library opened when the Class Browser starts. In the Command Window:
_oBrowser.SetDefaultFile()

If you want to clear the default class library execute the following statement:
_oBrowser.ResetDefaultFile()

This works great if you are constantly editing classes from the same class library for an extended period of time.

You can open the Class Browser with multiple class libraries

The first parameter accepted by the Class Browser is the file name of the VCX, or more accurately a comma-delimited list of VCX file names.

DO (_browser) WITH "examples\CPhkBase2, examples\demo"

Most Recently Used List

Have you ever right-clicked on the open button of the Class Browser? If not, give it a try and see a long list of previously opened class libraries. This has been in the tool for years, but I still show developers this little trick which saves me hours of drilling through directory structures.

Project Manager Can Start Class Browser

Double-clicking in the Project Manager on a Visual Class Library will open the class library in the Class Browser in VFP 9. Previous to VFP 9 nothing happened when you double-clicked on a class library. You can stop this from happening via a projecthook QueryModifyFile event. You can also intercept this in a projecthook via the QueryModifyFile event and run your own class library tool, or you favorite hacking tool like HackCX Professional (code to do this is posted here for HackCX Pro users).

Class Browser can open/maintain PRG based classes

The Class Browser has always been able to open VCX files, but many developers prefer to code their classes in program code (PRG). One of the disadvantages to taking the PRG route was the inability to use the Class Browser to maintain the classes and get a visual representation of the class hierarchy. Visual FoxPro 9 removes this limitation.

Renaming methods and properties without opening the class

You can rename methods and properties by right-clicking on the property or method and selecting Rename... on the shortcut menu. A dialog is presented which allows you to rename the property or method. Please remember that renaming a method or property does not magically rename the references in the method code. You will need to manually search and replace any references that are changed.

Copying and Moving Classes Between Class Libraries

You can open two instances of the Class Browser and use the mouse with the Ctrl key pressed to drag the icon in the upper left corner to the other instance of the Class Browser. This will copy the class to the other class library. This will maintain the same parent class relationship. If you do not hold down the Ctrl key you will move the class to the other class library.

It is not uncommon when I show this to developers to hear how they are surprised you could run multiple instances of the Class Browser. To me, this is one of the more powerful features of this important tool.

I posted the last one yesterday on FoxForum.com and a friend of mine popped me an email today noting this was cool and I should post this on my blog (prompting this entire post). Heck, how could I just pay it forward with one tip when I have so many others? So thanks Mary, it is all your fault this knowledge gets spread further into the Fox Community {g}.

Enjoy!

Tuesday, November 29, 2005

DBFs cause hair loss

I have been working on an application over the last couple of days for a client. I needed to add 20 or so fields to the OrderMaster table of this application. Simple thing to do, right? Not for me.

I use xCase to model data (both for VFP and for SQL Server). I love xCase for many reasons, but it is way better than using the native SQL Server and VFP Database and Table Designers. I added a bunch of fields yesterday and needed to add a couple I missed today. xCase has this wonderful feature which updates the table structures automatically. Today I get an error during the update:
The fields in table 'OrderMaster' did not match the entries in the database (Error 1984)
Argh! The "big brother is watching you error" - reference to George Orwell's famous book titled 1984. Sorry, I digress.

I believe this is the worst possible error you can get when working with VFP data. The solution recommended by the Help file is to use the VALIDATE DATABASE command or to remove and re-add the table to the database. Both of these options should include a disclaimer that says something to the effect of "both these solutions will hose the database worse and cause your hair to turn grey and fall out."

The better solution is to get out my trusty backups. Unfortunately, this morning I took my 250GB USB drive and the latest copy of the backups burned on DVD to the safety deposit box at the bank. This is my offsite backup scheme. I rotate the USB drive and permanently leave the DVDs in the box. No problem I'll just go back and bring them home. Too late - banks close at the worst possible times when it comes to being a developer. So now I get to wait until the morning to get the backups and finish up this project.

This would never be happening to me if I was working with SQL Server {s}.

I have emailed the client to let him know I am a victim of Murphy's Law, and there will be a short delay in getting him a new release. I just hate having to send emails with bad news.

Guess I have some time to push out another ViewEditor v3.6 Release Candidate this evening.....

Friday, November 25, 2005

Half Million Files and Counting...

Interesting statistic I realized this morning looking at the virus scan statistics: my drives have more than a half-million files scanned when it performs a full system scan. 507, 230 to be exact. That is a lot of files.

Tuesday, November 22, 2005

Southwest Fox 2006!

Just in case you are not on the Southwest Fox distribution list or have not seen postings on a forum, Bob Kocher dropped me a nice pre-Thanksgiving gift by announcing the dates for next year's Southwest Fox conference. From Bob:
There are still some details to work out so specifics will have to wait a week or so. For now, I am extremely pleased to announce Southwest Fox will return to Tempe, AZ Thursday, October 19, 2006 through Sunday October 22, 2006. We have a great new location this year and we are working on a couple of new and exciting ideas.
I will be there whether I am a presenter or not. Good timing since companies are already planning budgets for 2006. Way to go Bob!

Sunday, November 20, 2005

FoxPro 2.6 code under VFP 8/9

Today I answered the following question for what seems like the thousandth time: Why do objects on my 2.6 screen not show when I run the code in Visual FoxPro 9?

The answer is to shut off Windows XP Themes. You can do this using the form Themes property, or globally using _screen.Themes = .F. OR SYS(2700, 0) in the start up code for the application. This is an issue with the 2.6 READ compatibility mode. It is a known issue and one we do not expect to be corrected any time soon. It is also easy for a developer to fix.

The good news is I sense more and more FoxPro 2.6 developers are looking to move their application to Visual FoxPro. The bad news is this little problem causes developers more headaches. It also shows developers are trying to take advantage of VFP's backwards compatibility. I just hope they are not expecting this to be a long term solution and they plan on rewriting the application using the full power of VFP OOP, a solid application framework, and best practices we have developed over the last 10 years of developing VFP applications.

Thursday, November 17, 2005

AOL IM, stay out of my contact list

As you may have read before, I use AOL IM (AIM) to keep in contact with my kids online. Yesterday AIM was kind enough to automatically add two new "buddies" to my list. It informed me of this by interrupting me with an instant message:
"AIM added a new AIM Bots group to your Buddy List. AOL System Message: Send IMs to moviefone and shoppingbuddy for great holiday flicks and gift ideas. (To remove 'em, just right-click and delete! Learn More)"
So not only does it pollute my contact list, but it interrupts my day and my train of thought on some client work with a stupid message telling me it has polluted my contact list. Argh! Not only did I get interrupted once, but then I get another couple of support calls from friends and family asking me if these new bots are safe (after years telling them not to load this kind of stuff) and how to get rid of them. Double Argh! If Microsoft did something like this the media would be all over them asking them to remove things customers did not ask for, but AOL gets a pass on this. Unbelieveable.

Tuesday, November 15, 2005

F1 Tech Blog

Mike and Toni have started the F1 Tech Blog. This means two more very knowledgeable VFP people are sharing more with the community. Check it out. The first post discusses the recent AtoutFox conference in France. Welcome to the blogosphere guys!

VFP DATE() behavior change in VFP 9

Last week Mike Potjer reported a problem in HackCX Professional with the logic to decode the TimeStamp column of the VCX he was hacking while using VFP 9. The error reported is:
Error: (11) 'Function argument value, type, or count is invalid.' happened in frmhackmain.convert() on line 75
The line of code triggering the error has been working for a very long time. In fact, the code I use to decode the TimeStamp column has been around for more than 10 years with the only tweak being a change to comply with SET STRICTDATE TO 2 and a cleaner implementation to be Y2K compliant. The line of code triggering the error:
lcRetVal = lcRetVal + DTOC(DATE(lnYear, lnMonth, lnDay))
The TimeStamp should have been decoded properly as it was a valid TimeStamp. The values of lnYear, lnMonth, and lnDay were 2004.8074, 12.918774, and 29.0077209 respectively. In VFP 8 the value of lcRetVal was the character equivalent of {^2004/12/29} and in VFP 9 (both RTM and the SP1 Beta) the code errors.

Mike's bug report was one of the best I have seen. He provided me the steps, the error log HackCX recorded, and a screen shot of the debugger with all the details surrounding the line of code. It literally took me five minutes to reproduce the problem, make the fix, and send Mike the updated version. He tested it with the Class Library he hacked and all is well.

I was initially thinking of reporting this issue to Microsoft as a bug. As I was creating the reproducible steps, noting the observed behavior and discussing the expected results I started thinking about this in more detail. Here is the test code I was going to send to the Fox Team:

?DATE(2005.3232, 12.2323, 19.3232) && fails
?DATE(2005.3232, 12, 19) && Works

?DATE(2005.3232, 12, 19.3232) && Works

?DATE(2005.3232, 12, 31.3232) && Fails

?DATE(2005.3232, 11.99989, 19.988976) && Works, uses integer of parameters


I struggled with the expected results part of the report. I initially wrote down that I wanted the INT() of the parameter passed in. But what if I really calculated a number like 31.9898 as the day of the month. Should it round to the next day? In the context of my TimeStamp converter I want the INT() and this is how I fixed the code. I am not sure how other FoxPro developers would want this to work and thus came to the conclusion that a valid parameter cannot be bigger than a real date. The decimal portion of the month and day could be larger than the valid values. Therefore the error message reported by VFP was dead on and the documentation in the Help file notes valid parameter values (it just does not say how it addresses the decimal part of the parameter so you have to interpret the parameters as literal maximums).

The DATE() behavior has changed and this little tweak in VFP to tighten down the correct behavior of a function could bite you like me, so I thought I would share the story in case you run across this in your development. Thanks again to Mike Potjer for the excellent bug report and making me think a little about how this function is working.

New version of HackCX Professional will be posted this afternoon for existing and future customers to download.

Monday, November 14, 2005

German DevCon - Day 3

The final day is always the hardest when it comes to conference days. You are already exhausted from two intensive days of sessions. More importantly, there are the evening sessions in the lobby or hotel bar which go late into the night. Last night was no exception. I went back to my room after midnight and ran through my two sessions to ensure the examples were still running (more on that later).

I started out my day listening to Martin Haluza who presented his session called Converting Your Reports. Martin is the lead developer on XFRX. He showed us some cool stuff with the new version of XFRX and demonstrated some of the things he is working on. It was good to finally meet Martin. I really like his product and more importantly my customers really like the functionality of XFRX. Great session.

The next session I split across two sessions. I first attended Christof Wollenhaupt's German speaking session titled Multithreading in Visual FoxPro. This was a double whammy for me and I knew going in I was going to struggle with the German (maybe the biggest understatement of this blog entry) and the complex topic dealt with .NET and VFP. I just really wanted to see Christof speak. He is someone I respect and is extremely knowledgeable. I have hoped for years that he would be invited to speak in North America. I took the opportunity to see him and I was not let down. Bob from Southwest Fox - take note - invite Christof to speak at the next conference. He was fantastic. I made an observation of Christof's speaking style and asked one of the German attendees to confirm. Christof was speaking fast. The attendee gave Christof a high compliment and said Christof was speaking fast, and to quote him: "Christof is the Drew Speedie of Germany."

The other half of the session I sat in on Rick Strahl's demo of The Next Version of Web Connection. Rick was wowing the crowd. The good news: I understood a little more of what Rick is doing than what Christof was explaining so well. {g}

My Get More Productive with Visual FoxPro session was well attended. Based on a couple of people who talked to me afterwards, the session went pretty well.

After lunch I attended Rick Strahl's The Making of Help Builder session. Rick showed off several of the new features of version 4.20 and I learned a couple of tricks with graphics and resorting the help topics which will come in handy as I update the HackCX and ViewEditor Help files in the coming weeks.

My Builders Made Easy session is my favorite session to give and was glad Rainer scheduled my best for last. I really like builders and use the builders and property editors I demo during this session all the time. Today I could not get my Apply Naming Conventions property editor to function during the session. Just one of those glitches you get from time to time when you are demoing to 15 of your friends. Thanks to Andy Kramek who reminded me during the session that the Name property cannot be changed by a builder when you are working with a class. It works great for forms and objects contained on forms, but not for the container classes.

The last regular session of the conference I attended was Using the Treeview Control in VFP by Venelina Jordanova. This is the first time I have seen Venelina speak. She took a tough control to work with and demonstrated a number of ways to better work with the TreeView. Maybe Craig Berntson should have attended this session to help him with the Solution Explorer {gd&rvvvf}. I was surprised when I got to the room and found Venelina speaking English. I thought she was going to be doing the session in German. She did a great job.

The last session of the conference was the closing session. Rainer announced dates for next year (November 9-11, 2006) and gave away several packages donated by the vendors. Always nice to leave a conference on a positive and uplifting note.

This was a great conference. The sessions were terrific, the hospitality second to none, and the people were fun to hang out with. My head is full of new ideas and renewed interest in a couple of topics. Cannot wait to get to work.

At the speaker dinner we were talking about the conference and Steve Black asked me if the conference had met my expectations. I talked to a lot of people before going over to Germany and everyone I talked to about the conference raised my expectations higher and higher. So walking in the door I was expecting a lot. I told Steve my expectations were not only met, but were exceeded. If you are preparing your budgets for next year’s conference for you or your team, definitely give next year’s German DevCon a solid consideration.

(this blog was posted a couple days after it was written because we lost the Internet connectivity when the conference ended and I was not about to pay the hotel 22 Euros for connectivity for a couple of hours because they based the rental fee on a fixed window of time, not a linear 24 hours. Besides, 22 Euros is way to much when most hotels I stay at give it to me for no extra charge.)

Friday, November 11, 2005

German DevCon - Day 2

The fun continues here in Germany. I woke up this morning with a headache. I do get the occasional migrane, but the timing could not be worse for this one since you have to be on the top of your game to consume all the great sessions offered today as well as giving one this morning. No, I do not have a hangover. I have not even tried the German beer yet. So a couple of Tylenol with a bottle of water and off to breakfast.

I started out my day listening to Steven Black discuss the art of Application Metadata. I am a huge fan of driving different aspects of a software solution via metadata. Steve provided a prospective on this subject like few people in the Fox Community. Steve did a great job. He showed many examples of real world metadata solutions he has used with some of the commercial frameworks, created on his own (MsgSvc), and others he has implemented and extended for his customers. The key take away for me was reaffirming my approaches and getting a nice refresher on how cool MsgSvc is.

Next was Andy Kramek's Advanced SQL Queries session. In case you did not know this, Andy is one of my favorite presenters. He is one of the few people I would go to see to talk on the Form Designer, and he does not even do user interface code {g}. We all use SQL queries in some fashion and Andy taught me a couple new tricks with the new VFP 9 SQL syntax. The key take away from this session is to try out different queries that solve the same question. There were several examples of how one can get the same result set with two completely different queries. I can't wait to read the white paper from this session.

My Developer Tools: Build, Grab, or Buy session followed Andy's session. I took another couple of Tylenol before the session with another bottle of water. The session was well attended (I always say the more attendees the better). The session went better than yesterday's. I always learn something each time I give a session. After the session I was talking to a developer who is doing some very cool stuff with Event Binding and Visual Source Safe. This spawned off all kinds of ideas for me and the people I enjoyed lunch with after the session.

The session after lunch is the toughest to give and toughest to attend, especially after the types of lunches provided at this conference. So I decided to sit in on Rick Strahl's Using AJAX with ASP.NET. I have a project scheduled which should be perfect for ASP.NET v2.0 so I figured it would be a good idea to get some instruction from one of the leaders in our community. Rick's sessions never disappoint and this one was no different. He provided a real good overview on the topic. This material is definitely going to take some time to sink in (no surprise after reading his blog for a long time). The key take away from this session was Fiddler. This is a tool which shows the interaction between the Internet browser and the information returned from the Web server. Nice.

I played hooky from the next two sessions to call back home, and later to catch up with a couple of developers to discuss Fox Community related topics. At dinner Igor Vit (VFP MVP from the Czech Republic) presented me with a copy of What's New In Nine: VFP's Latest Hits, written in Czech. The book title is Co je noveho: ve Visual FoxPro 9.0. Talk about cool. We took a picture with myself, Doug Hennig, and Igor and Jan Vit (who are tech editors for the translation). My sincere thanks to the entire translation team who made this possible. The more people who can learn about VFP 9, the better the Fox Community will be. It is very humbling to see your work in both German and Czech. Knowing these are the number two and three markets for Visual FoxPro we can expect a large number of VFP developers to read our book.

I am writing this blog entry while listening to Ken Levy's presentation on What's New with XML in Visual Studio 2005. Ken started his presentation with a nice video interview he conducted with Rainer Becker (conference organizer), Doug Hennig, Craig Berntson, and Steven Black. It was humorous. The session was very informative.

It was a great day, but only one more day to go. And good news: the headache is going away.

Thursday, November 10, 2005

German DevCon - Day 1

I want to start out by stating the German DevCon has already lived up to the hype I was given before I arrived. The sessions have been exceptional, and the food - well this could be a blog all by itself {g}.

I started out the day sitting in on Doug Hennig's Mining for Gold in XSource. I learned several new things, but the topic that stands out is the exposure he provided on the Builder framework included in XSource. I recall hearing about this before, but it was simply explained during this session and Doug showed how you can build a simple, yet powerful builder in less than five minutes. Now I have to update my Builders Made Easy session, which I am giving on Saturday.

Ken Levy provided the keynote at the conference. I skipped this since I have seen Ken do the keynote at several conferences this year. There was a lot of positive feedback after the session during lunch so I can only assume it was good.

My first session went okay. Deployment is a dry material session and it was scheduled right after a big lunch. Tough to do on the best of days. One of the things I learned during my session is to never give a session that depends on interaction with the attendees in the audience in Germany. After I submitted this session for consideration I learned the German speaking attendees typically do not ask questions during English speaking sessions. The session went fine, but did not meet my high standards. Fortunately, the other three sessions I am giving do not depend as heavily on the interaction.

The next session I attended was Dan Jurden's Introduction to SQL Server Reporting Services. I have wanted to get an introduction to this product for a long time. Dan did a good job of introducing this topic and giving me the jumpstart to get this installed when I return home. The product looks promising and works with all kinds of data including SQL Server and VFP DBFs. Dan demonstrated several examples of creating reports via the Visual Studio 2005 IDE, but also ran the reports in a VFP form.

The last regular session of the day was Lisa Slater Nicholls' Advanced VFP Reporting. It was a typical Lisa session. Enough said.

Well, off to dinner and probably adding another Kilo to the waistline and learning more about developing in VFP. More later...

Wednesday, November 09, 2005

Germany provides shock and awe

Monday we headed to Cologne (Koln) and walked into the Cologne Cathedral. Wow. Wow. Wow. Last year I was in New York City and we walked into Saint Patrick's Cathedral, which was impressive. But the gothic design, pure size, and number of relics inside the Cologne Cathedral just knocked me over. We also toured the treasury below the cathedral and I can say I never have seen so much gold and raw church history in one place in my life. The rest of the day was spent walking around the city and driving for the first time on the Autobahn (no new land speed records for me). I also got to experience the thick pea soup weather of western Germany.

Tuesday we headed to Trier and experienced the Trier Cathedral and Trier Basilica. They were both very impressive. We also walked around and under the oldest building in Europe (2000 years old). Now living in the United States, the oldest standing structure is probably the adobe houses out west and they are nowhere near 2000 years old. We are talking about a structure built around the time Jesus walked the Earth. How cool is that? We also visited an amphitheatre and a stadium where animals chased around people for entertainment purposes. I doubt that would have been much fun, but the stadium was interesting. I have taken more than 150 pictures since arriving here Saturday.

Oh, and another first, my first trip to Luxembourg (country number six). We needed to refuel the rocket, I mean the car, so we headed over to Luxembourg where diesel fuel is 20-30 cents cheaper per liter. I also purchased a Coke for good measure.

In case you are curious, Doug set his own personal land speed record driving 200 kph (on a long turn no less). Heck, I am almost getting use to the driving over here. {g}

Tuesday evening we stopped in to visit a couple of Jeff's relatives who are going to put on a nativity scene show. We are talking about hundreds of nativity scenes from around the world on display in a tent which use to be a indoor tennis court. All the profits from this five week show will go to a children's cancer hospital. They have been working on this since July and use their six weeks of vacation to put this all together. Amazing.

Today we are going to take some pictures of the town we have stayed in for the last few days, then head out for some quick souvenir shopping. Once we say our good-byes to our generous hosts we head back to Frankfurt to get ready for German DevCon 2005. What a week this has been.

Monday, November 07, 2005

New Personal Land Speed Record

So yesterday (Sunday) was our first day of sightseeing here in Germany. Jeff's aunt and cousin (Jeff works for Doug Hennig) drove us all around the Mosel valley in western Germany. We ate at great places (potato pancakes were fantastic), the weather beautiful (sunny all day), listened to a German band in a beer tent (not the best according to the locals), and the sites were spectacular (drove along the river and toured a castle in Cochem).

On the way home we drove on the Autobahn as we had earlier in the day. I was not driving. Actually I think it will take some time to get use to the style of driving here in Germany. The drivers here make the most aggressive drivers in Michigan look tame. Anyway, as I mentioned someone else was driving, but we hit 210 kilometers per hour (this is 130.4879504 mile/hour (mph) according to OnlineConversion.com). This is definitely the fastest I have ever traveled on the ground in this lifetime. So among other firsts (first time in Europe, first time in Germany, first trans-Atlantic flight, first time I have seen London from the air) on this trip I have a new personal land speed record, and I lived to tell about it. Fun day.

Sunday, November 06, 2005

In Germany

I flew to Germany Friday for German DevCon. This is my very first trip to Europe and so far it has been very enjoyable. I am already adjusted to the new time zone by default of not sleeping on the flight and only a one hour nap yesterday. The flight was fantastic and the view over the British Isles spectacular in the early morning. I will be spending the first half of the trip sightseeing with a couple of friends in western Germany, then heading to Frankfurt next Wednesday for the start of the conference. I am hoping to blog about the conference while I am here, but I just might be a bit busy with my four sessions and plenty more I want to attend. I will defnitely provide a summary upon my return. From what I have heard, this is suppose to be one of the best FoxPro conferences in the world. Have a good week.

Wednesday, November 02, 2005

Pistons' Basketball

Looks like basketball fans in Detroit are in for another good year of Pistons' basketball . Terrific game to start off the new season. Already underrated by so many alleged experts. We have the rest of the league exactly where we want them. I am predicting a 60 win season if they stay relatively injury free. Sweeeeet.

Tuesday, November 01, 2005

Scobleizer back on my radar

Like Rick Borup, I am finding myself a bit overwhelmed with the influx of information from all the bloggers and RSS news feeds I am consuming in FeedDemon. Last week I realized my Scobleizer feed had not registered in a couple of weeks. Then I remembered Robert was moving his site.

It dawned on me that a couple weeks went by and I had not really missed this feed. Interesting. Should I remove the feed from my regular pulls? Nah, Robert posts gems once and a while and often points me to new blogs which are valuable. I also enjoy the risks he takes each day poking fun at the company he works for (Microsoft). I often find myself agreeing with the things he thinks they should be doing to better the company.

Today is a fine example: he points me to a blog I might have missed, The Dilbert Blog. Thanks to Scott Adams who adds humor to my life - subscribed!