Tuesday, March 22, 2005

VFP 9 Hidden Gem: The Beautify Directive

VFP 9 has many major enhancements that make the justification to purchase it a no-brainer. Then there are the many little things the Fox Team threw in the product to make our development lives a little easier. The new beautify directive (note the singular) is not only one of the little things, but until recently it was one of the undocumented gems.

The Beautify feature has been in Visual FoxPro since the beginning. It cleans up code and makes it consistent. One specific function it provides is changing the case of VFP keywords. This works well in most cases and most of the time it does not matter what case the code is because VFP is a case insensitive language. However, there are exceptions when case does matter. For instance, DLL declarations can be case sensitive. If you are unaware of this issue you can break code accidentally by running the beautify feature on your code. The reality of this problem could be spending hours trying to debug code that worked fine until you went to the extra effort to make the code look consistent and meet your company’s coding standards. Not much fun.

In VFP 9 the Fox Team introduces a new directive (the case of the directive does not matter).

*# beautify keyword_nochange
*# beautify


You may notice something a little different about the beautify directive in comparison to a compiler directive. It has a comment character proceeding the “pound” or “sharp” character (#). This is required and has a nice side effect of making the code backwards compatible. What this means is you can include this new directive in any code, use VFP 9 to beautify it, and still compile the code in VFP 8 and earlier.

The directive lines bracket the code you want the beautify process to ignore. The rest of the beautify functionality (indenting comments, continuation lines, procedures and CASE statements, and converting annoying tabs to space) is still applied to the code. The only thing not applied is the casing of the keywords.

The code sample Microsoft provided is a very good example, and one of the more common ones developers could be burned by: the DLL call to ShowWindow. ShowWindow is both a common DLL Declaration and an intrinsic VFP property to specify if a form is a top-level form. If you beautify the code with the DLL Declaration it will respect your preference of upper of lower case and break the code. Here is a code example before beautification:


*# beautify keyword_nochange
PROCEDURE PleasShowWindow
LPARAMETERS tcFormName, tlDoIt
* This is a comment which could be indented or not

DO CASE
CASE PCOUNT() # 2
CASE PCOUNT() # 1
OTHERWISE
ENDCASE

if llSecurityClearance > 30
#DEFINE SW_MINIMIZE 6
DECLARE INTEGER ShowWindow IN WIN32API ;
INTEGER nHWND, ;
INTEGER nCmdShowShowWindow(_VFP.HWND, SW_MINIMIZE)
endif
endproc
*# beautify


Try it out in VFP 9 and one of the eariler versions to see the difference. This example also shows one of the drawbacks you have with this directive. You need to be careful where you place thedirective or you will find other keywords you want cased to your preference getting ignored.

This particular new feature is not documented in the released version of the VFP 9 Help file and was not included in the Hentzenwerke Publishing’s What’s New In Nine: Visual FoxPro’s Latest Hits (disclosure: I am one of the authors on this book).

Saturday, March 19, 2005

ThunderChickens Rule Detroit Regional

The ThunderChickens are the team of brilliant students in our school district banding together to build a robot in the FIRST Robotics Competition. The competition for the last couple of days was held at Wayne State University in downtown Detroit. Since White Light Computing is one of many sponsors and I have a vested interested as dad, I decide to play hooky from the office the last couple of days. It was energizing and the team did fantastic, finishing fourth in the qualifying matches, and first overall in the elimination round.

From the FIRST Web site: “FIRST (For Inspiration and Recognition of Science and Technology) is a multinational non-profit organization, that aspires to transform culture, making science, math, engineering, and technology as cool for kids as sports are today.”

This is not robot wars you see on television. This year’s game is a fury of tic-tac-toe with tetrahedrons placed on top and underneath larger tetrahedrons. Stacking them as high as the robot can reach and hopefully having your team’s color on top at the end of the 135 second round. Three teams form an alliance during match and work together to ensure they have the top tetras. The robots work autonomously for the first 15 seconds of each match. Then the students jump in and drive the robots around the playing field.


You can watch a QuickTime animation of the Triple Play game on the FIRST site (check out the “Triple Play Animation” under the downloads), but to see it in person is amazing. Watching our young adults figure out strategy, solve engineering problems, attempt to defy physics, challenge their own limitations, and some how get it all done in six weeks from requirements delivery to shipping a robot is way cool.


My favorite part of this competition is that teams help other teams succeed. Share experiences, share parts, share code, share tools, share ideas, and help each other get better. Sound familiar? Absolutely, much like what the Fox Community is all about. Helping each other be better at what we do. The students really learn first hand about teamwork and collaboration. Each of the teams also takes on a local community service project. They also work with the local elementary schools to build Lego robots for a competition in the Fall. Not only do they learn what it takes to be mechanical, electrical, and software engineers, but they learn about teaching others, giving back, and paying it forward. The skills they learn during the competition will serve them well throughout their lives.

This weekend the ThunderChickens also won the Sportsman Award to add to the collection of awards they won (Entrepreneur and Sportsman) at the Finger Lakes Regional where they finished third in the qualifying matches and were eliminated in the semi-finals.

So the ThunderChickens have accomplished one of their many goals (winning the Detroit Regional). They still have more, like winning a Chairman’s Award, and winning the national competition in Atlanta. Therese and I are hoping to get to Atlanta. After this weekend, I cannot see how we can miss it!

My son Chris is one of the programmers on the team. He tried to explain to me a couple of times how they code this machine to run by itself and respond to the drivers movements of the joystick, and how it will literally spin on a dime. Using code to drive a motor, spin wheels, work with pneumatics to control the arm, and all the other cool stuff they do made my head spin. Databases are so much easier.

Chris, we are very proud of your teamwork, the team accomplishments, and the fun you all had in the regionals. I am continuously amazed how this all works, but I am not amazed how well the team has done knowing the students and mentors involved. I hope you take this energizing experience and expand on it during the national competition.

Now if the ThunderChicken Web site was updated...

Friday, March 18, 2005

Mobile Developer Backpack Contents

I am a mobile developer. I work in my home office, at a client’s office, my in-laws cottage, in my camper, in an airport, hotel room, and even in the car as my wife drives. My primary machine has been a notebook/laptop for the last nine years and it pretty much goes everywhere. Because of this lifestyle, I have a computer backpack and in it I carry my life.

I recently was asked what I have in my laptop bag. Someone I know recently purchased a laptop and wanted to get a head start on the list of items they would be purchasing. Here is the list of accessories I carry with me everywhere I go:

  • Portable mouse
  • Extra battery and power adapter
  • Thumb drive (256 MB)
  • Ethernet cable and phone cable
  • Kensington lock
  • Baby USB Hub (four port)
  • Headphones with microphone so I can Skype
  • CD case with CDs to install software
  • Portfolio for note taking
  • Spare CD-RW and DVD-R
  • Palm 515
  • Cell phone
  • Cell headphone/microphone
  • Cell phone spare battery and car charger
  • MP3 Player
  • Business cards
  • Sunglass clip
  • Pens & highlighter
  • Mini-flashlight
  • Tylenol
  • Granola bar
  • Cash

The entire bag with the laptop and accessories weights 21 pounds. This version is downsized considerably from my older notebook and backpack (at least five pounds lighter). The laptop is lighter, the portfolio I now use is half size, and I parted with junk I don’t use daily. The new notebook has a Centrino and 4-5 hour battery life so I could probably skip the extra battery, but I never know when I am going to need it.

So what do you carry in your computer backpack or case?

Wednesday, March 16, 2005

Foxcast - got to have it!

Foxcast is an excellent resource for the Visual FoxPro developer. Just in case you are not familiar with the concept of Foxcast, it is free Webinars presented by knowledgable people in the Fox Community. These live Webinars are recorded so you can download them and watch them on your own time.

The live Webinars require four things:
1) Registration for the Webinar
2) A solid connection to the Internet
3) A long distance phone call
4) Your dedication and desire to better your career

The long distance phone call might turn some people off the live feed. The way I reduced my overall expense was to follow some good advice from Doug Carpenter (the moderator of this venture), and head out to Costco or another reseller of phone cards. I bought 600 minutes for the cheap price of two cents a minute. I watched Drew Speedie's and Doug Hennig's presentations live and used it for the session I presented, and still have minutes on the card. If the phone call is a barrier (like being outside the USA), there is always the download.

The only other problem I see for some developers is the download is big (~300 MB), and some developers still have dial-up, and others have to pay by the minute. My guess is someone will burn these files to a CD and ship them for a nominal cost (hint: there is a business opportunity, or a special contribution to the cause).

If you are someone who wants to present, great. It is simple and the folks at Visionpace will step you through the process and let you practice a bit before you present live.

I have personally received more feedback on my Debugging Essentials Foxcast than any other presentation I have made at conferences or user groups. The reason is simple, it has reached a larger audience because of the availability of the download. I also know the video has been shown at user groups all over the country and downloaded by developers across the globe. I could not have presented the session in person at all these user groups and still made a living.

Foxcast has enabled user groups to easily get quality presentations from outside speakers, and at the same time, allowed speakers to pass along their information and experiences fast, and to more people. Another win-win-win! If you want to download one of the existing Webinars, register for the session and you will get an email telling you where to download it. Simple.

The next one is scheduled for March 21, 2005. All around great speaker, top-gun developer, and nice guy, Doug "the report dude" Hennig will be presenting the topic "Extending the VFP 9 Reporting System at Run-Time." I suggest there is not a better time to try Foxcast out than this month.

Absolute kudos to Russ Swall, Doug Bliss, Doug Carpenter, Drew Speedie, and the entire leadership team at Visionpace for sponsoring this resource and making it happen. There are not many companies in our community with the dedication, the funding, and the vision to make something like this happen.

Monday, March 14, 2005

Microsoft Marketing FoxPro

For all those developers screaming to hear Microsoft market Visual FoxPro, well here is one example: Developers Report on Power, Productivity and Extensibility of New Visual FoxPro 9.0.

From Ken Levy: "The news of this PressPass article is being sent to many IT journalists today for education on Microsoft's release of Visual FoxPro 9.0 and to promote the generation of media coverage and articles on VFP 9.0."

This is definitely a step in the right direction from my perspective and hope Ken continues with releases of this type. Nice to see positive news like this.

Interesting details on how two of the Fox Community's finest have used VFP 9.0. Great success stories. Thanks to John and Doug for their contribution to this story.

A call to arms: I hope all FoxPro developers have a story to tell Ken, the Microsoft Fox Team, and the big wigs at Microsoft. The more stories we can provide Ken and the marketeers, the more opportunity he will have to spread the word about how great this product is and the great things we can do with Visual FoxPro.

Thursday, March 10, 2005

Go Golden Grizzlies!

I graduated from Oakland University in Rochester Michigan 19 years ago. I really enjoyed my four and half years on campus. When I went to Oakland it was a small university with 7,000 students. It was better known as a school with the second best Computer Science program in the state (even higher than the University of Michigan at the time), than a school with a basketball team. We had champion caliber swim and soccer teams while I was there, but basketball not something that attracted a lot of attention. Oakland molded computer geeks, engineers, nurses, business people, teachers, actors, journalists, and other professionals, but not a single NBA player.

I am very excited to see our basketball team is in the NCAA Championship "big dance" and one of the finest universities around is getting some national exposure. Maybe the luck of the hard working Pistons is rubbing off. The home of the Pistons is only a 10 minute ride from the middle of the Oakland campus.

So to all my friends who went to the fine University of Michigan and over the years have ribbed me about us not having a real sports program: watch the Cinderella Golden Grizzlies march toward the final four.

I think it would be fun if Oakland plays the amazing Fighting Illini so I can have some fun with Rick Borup.

Saturday, March 05, 2005

The Simple Common Courtesy

One of my pet peeves in this world is common courtesy. I have run into this situation far too often in my life, and today I run into it for the first time in the blogosphere. Instead of taking the opportunity to teach me something about blogging protocol via a short email or a brief phone call, I get called out in someone else’s blog for being a dope and not including the site feed on my blog. Heck, I have no problem making mistakes because this is one of the ways I learn. I just hate hearing about it through a third-party, or through a third-party source. I guess the more I think about it the public smack across the head is not uncommon these days, especially in blogs.

This huge oversight would have been corrected much sooner if I was informed with the email or phone call. It only took me a couple of minutes to add this to my Blogger template and republish the blog. Simple.

This is not the first time I have been called out on someone’s Web site. Years ago I wrote an article in FoxTalk on the new Top-Level form feature introduced in VFP 5. Several years after this article was published I was surfing the Web in my never ending quest to learn more about Visual FoxPro development. I hit a site by a well known VFP developer and speaker. Here is a quote from this posting:

    All together now, let me hear you say it:
    TopForms # SDI
    ... and don't you ever forget it.

    All kinds of people who should know better make this mistake, from MS support people to gurus to helpful-types on the newsgroups. I'll quote from one example, from the lead paragraph of a lead article in FoxTalk engagingly titled "Using VFP 5.0 Top-Level Forms". (I single out this example because it perfectly illustrates the conceptual problem. However, its author, Richard A. Schummer, is no better and no worse than many other FoxPro experts who might have written these words. Don't blame him. Also, this particular article was written in 1997, so perhaps Mr. Schummer knows better by now!)

I never received a single correspondence from this person when the article was published or when they made the post. Instead I came across this posting years later and likely years after it was posted. I sent this person an email thanking them for the information and expressed my opinion about the topic I am blogging about this morning. I learned a lot that Sunday morning, both about Top-Level forms vs. SDI, and more importantly about the individual.

As far as a site feed, I guess I am truly spoiled by FeedDemon, created and sold by Bradbury Software. All I do is paste in the location of the blog in the New Channel Wizard and the majority of the time the channel is set up and I get the feed within seconds.

I want to take a second here and thank Rick Borup for answering my many questions about blogging and setting up a blog, and for his excellent recommendation to check out FeedDemon.

Well, as you can see this huge faux pas has been corrected. Craig, there are absolutely no hard feelings and thanks for setting me straight on the site feed. I hope this correction allows me to be added to your blogroll so others will get a chance to follow the link to my postings. And for those keeping score, I sent him an email before I posted this entry.

Tuesday, March 01, 2005

Amazing Race 7

One of the few shows on television I will watch on a regular basis is Amazing Race. Tonight was the start of the 7th edition. It is definitely a guilty pleasure. I really enjoy seeing different places around the world, observing the human reaction to pressure situations, and seeing people extend themselves past what they initially might have thought as impossible.

This show is a road rally on steroids, but instead of one evening of excitement in your home town, this trip takes eleven teams of two around the world, puts them in challenging situations, and forces the team to manage their money, complete physical challenges, and work together to be first at the end of the segment, and more importantly at the end of the entire race. The team that survives and finishes first wins a million dollars. The last team to arrive at the destination for eight of the legs is eliminated from the race. There are usually a few non-elimination legs of the race, but the last team loses all their money and gets no money to start the next leg. This race has interesting teams. After a couple of weeks you develop favorites and hope the other teams are eliminated. It is a fun show to watch as a family.

The host of the show is adventurer Phil Keoghan. I am reading his book No Opportunity Wasted. This book outlines a philosophic approach to life which mirrors my approach. Live your life to the fullest by setting life goals, and then working toward accomplishing these goals. Phil adopted this approach after a near-death experience, and hopes you can adopt the approach without getting so close. Developing your "List for Life" is a contract and forces you to list things you want to accomplish before you die. Phil's approach is different from mine because he developed eight categories and challenges you to add at least one goal for each category. This is definitely an interesting book, with inspirational stories and much food for thought.

I will blog my complete list one of these days. Many of my family and friends know I want to experience several natural disaster events first hand (earthquake, hurricane, volcanic eruption, tornado). Another one is to visit all 50 states in the United States and all thirteen Canadian provinces/territories. Another one is to see a shuttle takeoff and landing.

While developing a set of goals is important, the key most people forget is the list is dynamic. I believe the key is to continuously add goals to the list, even at a faster rate than you are accomplishing them. You can erase things no longer important to you. One of the mistakes I made several years ago is letting my list nearly evaporate and quite frankly, I was not working toward my goals. Without defined goals you lose focus and drop off the path. I can tell you from personal experience, you will accomplish much more in life when you have goals to attain. I believe this was another thing I learned in Kindergarten.