Aug
01

I just got off the phone with Bob Kocher who tirelessly works on the Southwest Fox Conference every year so we can all come to Arizona and have a ball, and learn about our favorite development tool – Visual FoxPro. Bob and Sharon put on a fantastic conference as many of you already know from reading my blog, other blogger’s posts, the UT Conference notes, and posts on the various Fox forums.

I am very passionate about going to conferences. I feel they are the single biggest way one can jump start a career advancement move. It is a way to rejuvenate your spirit and it brings fresh ideas instantly to your current projects. I feel everyone should attend at least one conference a year. I also feel Southwest Fox is a great conference!

I made Bob an offer this evening to back up my passion. This is the first time Therese and I have done this. I am proud to announce that White Light Computing is offering one scholarship to attend Southwest Fox 2006. This is a US$300.00 scholarship (half the current “tuition” to register for this year’s event in October).

So how do you qualify for this? Simple, register for Southwest Fox 2006 between now and August 15, 2006. White Light Computing and Southwest Fox will randomly draw one name from the list of attendees who register between August 1, 2006 (today) and August 15, 2006 after the registrations for those days are processed.

This means you have to pay for the conference now. White Light will send you a check in the mail (or to a PayPal account) for US$300.00 before the end of the month (definitely before your credit card bill is due).

Just a few rules and regulations and notes:

  1. One name will be drawn.
  2. The winner will be notified by a phone call from Rick Schummer.
  3. The conference registration cannot be cancelled. You may send another developer/person to take your place, but the registration cannot be withdrawn.
  4. You must be 18 years of age to be eligible.
  5. Except where prohibited, participation in the scholarship constitutes winner’s consent to White Light Computing and Southwest Fox to use winner’s name, likeness, opinions, biographical information, hometown and state for promotional purposes in any media, worldwide, without further payment or consideration.
  6. Registrations must be processed before midnight (Mountain Time) of August 15, 2006.
  7. Each full conference registration is one entry in the drawing.
  8. Odds of winning will depend on the number of registrations during the allowed period.
  9. The judges rulings are final.
  10. All tax considerations are the responsibility of the winner (consult your tax accountant for specific details).
  11. No employees of White Light Computing, or any family members of the employees of White Light Computing are eligible.
  12. Your mileage may vary, some settlement may occur during shipping.

Your boss is giving you a hard time? Let me know. I am willing to talk or email each and every one of them to help you get the okay to head to any FoxPro conference. I am totally serious. I have fought numerous times with my old bosses to get myself to a conference as well as teammates. I have a way of getting them to see the light!

White Light Computing is having a fantastic 2006! This is just a little way Therese and I are going to pay it forward!

So what are you waiting for, get moving, tell your Fox friends, get registered for the best conference of the year!

Good Luck!

Jul
19

Anyone who has worked with VFP data will tell you the DBF is a fixed record length and structures do not have variable length columns, even with the introduction of data types like VarChar. A VarChar is still a fixed length field in the table structure, but internally VFP treats it differently when you work with the data. If you design a numeric field 5,2 you have two significant digits, a decimal place, and two decimal places. Right??

Yes, but only most of the time. {g}

Today I ran into a situation that probably has happened to me only once before in more than 17 years of working with DBF files. I am working on a death march conversion. Part of the conversion does some mathematical calculations with cost. The columns we are fitting data into are N(5,2) so any information 99.99 or less should fit just fine. We ran the conversion and the client was complaining about data being off by 2 cents. We figured there was some rounding problem with the data. My co-worker on the project watched the process in the debugger. The data in the SCATTER NAME object had 78 cents (.78). The next line executed is an INSERT INTO … NAME and in the column was 80 cents (.80).

I was asked by my co-worker to confirm he was seeing what he thought crazy behavior in VFP. I asked him to BROWSE the table. Sure enough it was true. This is sort of what we saw in a column with two decimal places of precision.

89.54
98.29
05.78
147.8

If it was a rounding problem we would have seen several of the values round to the tenth. What caught my eye was the missing hundredths value in the last and current record. At worse I expected .80, but in this case we saw a three whole digits and one decimal place stuffed into a N(5,2) column.

Argh!

Visual FoxPro is dynamically interpreting the structure a different way. I think it should creat an overflow condition, which immediately sticks out like a sore thumb. Instead, we lost a couple of hours of time tracking this down.

It is not until I enter in a numeric field with more than 5 significant digits that I get “Numeric overflow. Data was lost” (Error 39). Interesting behavior for sure. I will not be reporting this as a bug because it is probably the way DBFs have worked since the beginning of time, but it sure can lead to some expensive debugging sessions if you are not aware of this behavior.

I wrote a short test program to see if this is an issue with a SCATTER NAME object vs. doing a standard APPEND BLANK and a REPLACE, but the behavior is the same.

Hopefully this blog entry will save you some time with this problem down the road.

Jul
11

(Somewhat off topic)

So where have I been? Vacationing – yep, a real vacation.

This year I decided I am going to vacation like normal people. You might not know this, but most people actually leave work behind when they go on vacation. So I did this over the last twelve days. Okay, not all twelve days, but for the majority of the twelve days. Heck I was disconnected from the Internet most of every day, and sometimes all day. One day when I reconnected I downloaded over 1000 messages.

Last fall while watching The Amazing Race (television show on CBS here in the USA) we saw some beautiful country when the teams visited Yellowstone. It reminded me how much I have wanted to visit this part of the country. I have wanted to go there ever since seeing my grandfather’s slides when I was a young boy. Last month I convinced the family to go. They voted unanimously for this. The other option I put on the table was to visit Louisiana/Mississippi where Katrina hit, and Houston, Texas (for Johnson Space Center). Seriously, I thought seeing the destruction first hand would be something good for us to experience.

At first Therese was a little nervous when I mentioned camping without electricity. Then it hit her, if Rick does not have electricity he has no way to run his computer once his battery runs out. She was sold.

We packed up the family (including my parents and nephew), connected up the camper, and headed west on a 1800 mile journey through Michigan, Indiana, Illinois, Wisconsin, Minnesota, North Dakota, Montana, and Wyoming. We also stopped by Idaho since it was still on my list of states to visit. I am now down to three (Alaska, Louisiana, and Oregon -I plan on visiting two of the three next year).

Yellowstone was spectacular! It surpassed all my expectations except for not experiencing an earthquake. We saw everything from Old Faithful to the Grand Canyon of Yellowstone. We went to the top if a 10, 000+ foot pass to get there, visited each and every entrance, and hiked though geyser infested areas. The Mud Pots were cool. The falls were spectacular. Revisiting the Continental Divide is always fun. The views just kept getting better all week. We saw a ton of Elk, dozens of Bison, and even on Grizzly Bear. The weather was spectacular.

We also visited the bridge where Drew and Brent died last September. It reminded me of how fragile our lives are. Being there also brought more questions to mind than answers on how such a tragedy could happen to these two.

After Yellowstone we visited the Grand Tetons. These are the mountains I have always wanted to visit. I have seen mountains in Colorado, Washington, California, and Tennessee, but these mountains are the best I have seen. Therese said these were the closest mountains she has seen to the Alps.

I took over 400 pictures and an hour of video.

On the way home we headed out the east entrance of Yellowstone and drove to Mt. Rushmore in South Dakota because my nephew has not been there. We also travelled through Iowa, Illinois to get back to Michigan.

We have decided Illinois is the state most unfriendly to travelers with RVs (sorry to all my friends there). They restricted us to 55mph when everyone else can drive 65mph including some trucks, they charge more than triple the tolls over the price of a car, and we had long traffic jams around Chicago. One toll booth was responsible for a 15 mile backup and then they charged us US$8 when cars were charged US$2. Appalling.

In Michigan you can travel on our roads for free. So come to Michigan where vacations are better for drivers of all types.

Wyoming is a fantastic state to visit. I have to rate it as one of my 5 favorite to visit. If you have not visited this part of the country, make sure to add it to the list of places to visit. You will not regret it.

So we drove over 4000 miles, added three new states to our list, stayed in some great hotels to and from Wyoming, and one really crappy Holiday Inn Express in Benton Harbor, Michigan (they stuck us in a smoking room when we reserved non-smoking, and told my parents to come get a plunger to unplug their toilet when they arrived to a plugged toilet). The hotel did not even appear to be near capacity, but they refused to put us in a better room.

Overall – one of the best vacations I have ever had. Now for the fun part, getting back to work. I guess it should not be too hard since I love what I do. Good thing, I have a lot to do! {bg}

Jun
27

I am a huge proponent of code walkthroughs. There are many benefits:

  1. Cross training team members on development language
  2. Cross training team members on business the software serves
  3. Lower bug counts per release
  4. Enforcement of coding standards
  5. Flushing out potential inefficiencies in the code
  6. Communication of development techniques

A little over a week ago I blogged about VFP Macro Substitution Techniques and I received a couple of private emails offering suggestions for the code examples I posted. One in particular was very helpful from Sergey Berezniker (major VFP guru, VFP MVP, and UT posting bot {g}). He introduced me to the GETPEM() function. So instead of this code:

lcPropertyValue = loPickedControl.&lcProperty;

I can use this code:

lcPropertyValue = GETPEM(loPickedControl, lcProperty)

As Sergey points out, the macro substitution code will be slower. Now I could argue the time savings will be immeasurable to the human mind, but the code is way more readable. This is what code walkthroughs are all about!

I have seen developers get very defensive on the constructive criticism side of the code walkthrough. I on the other hand welcome suggestions to make me a better developer. This morning I did a code walkthrough with my son who is subcontracting for me on a Web project. I know little-to-nothing about PHP, yet I was able to make some subtle suggestions to his code to make the application better.

It is important when doing code walkthroughs to not attack other developers. This is one of the simple golden rule things. Treat other developers with the same respect you want when you are the developer who is in the “hot seat.” I regularly and informally walk through code for other developers, especially those I am mentoring. You would be amazed how much I have learned by doing this.

So thanks again Sergey, and others who were kind enough to nudge me with suggestions. I am a better developer today because you took the time to do so.

Jun
20

I got an email from Bob Kocher this morning noting the finalization of the speaker list and he has pulled another one out of his hat with Nancy Folsom. Another fine selection. Nancy did a great session on Refactoring at GLGDW 2006, so her session Refactoring à la Carte is another one to add to your “must see” or “must read” list.

Jun
18

A couple of weeks ago I wrote a builder that generically manipulates properties. I was trying to recall a technique with macro substitution I used a couple of years ago to do this very thing.

I opened up Code References started searching source code for “..&” (period, period, ampersand) because this is what I thought I needed. The search came up with no results. This surprised me. I could have sworn I needed two periods.

It turns out what I needed is simply “.&” (period, ampersand). You see, what I intended to do is concatenate a macro substituted property name to the end of a reference to an object in the live designer. The final code is pretty straightforward once you know what you need. In this case I have a combobox with a list of objects in the form or class designer. The combo has an array with the full containership path to the object from the outermost container. To get an object reference I executed the following code:

lnComboRowSelected = this.cboObjectsToPickFrom.ListIndex lcAddPath = this.cboObjectsToPickFrom.aItems[lnComboRowSelected, 2] loPickedControl = this.oControlList.oObject.&lcAddPath;

The properties I am working with are in a multi-pick listbox. To get the value of the property on the control I use the following code:

lcProperty = ALLTRIM(this.lstCommonProperties.aItems[lnI, 1]) lcPropertyValue = loPickedControl.&lcProperty;

In this particular builder (which will be discussed in a future issue of Advisor’s Guide to Microsoft Visual FoxPro) I generically allow you to pick to controls, select the properties you want identical, and the builder will migrate the properties. This is using the BuilderControls framework also discussed in the article. I use the same technique twice in the same method that moves the property values between the controls.

It bothered me a bit that I could not figure out why I originally thought I needed two periods. Then last week Tracy Pearson made a post on ProFox that was the smack up the side of my head jogging the correct memory of what I was thinking about. This is the second technique of using macro substitution.

I often work with tables or cursors to store data and often know the structure using AFIELDS() or some other technique. I control the alias to the cursor programmatically and store it in a memory variable. If I want a specific value from a column and need to include the alias (something I always like to do to eliminate the ambiguity factor) in the reference to the column. If the code is a generic to the cursor I can use macro substitution to manipulate the data:

lcAlias = ALIAS()

ldInvoice = &lcAlias..dInvoice;
lcCustomerName = &lcAlias..cCustName;

As Tracy pointed out in his post: “One dot to end the macro substitution, one dot for the normal table.field”

It made me feel better that there was a two-period macro substitution technique, I just wish I would have saved a half hour not looking for it the wrong way {g}. Hopefully this post will either introduce you to the techniques, or serve as a reminder they exist and they are completely different.

Jun
17

Just in case you have not seen this yet, Bob Kocher has more surprises for you at Southwest Fox 2006. I just read that he has added Rick Borup, Milind Lele, Rod Paddock, and Christof Wollenhaupt. Wow!

I think this will be Christof’s first speaking engagement in the USA, but he has been a big time speaker at the German DevCon for years and someone I really respect. His knowledge of VFP and software development are tops in our community. I am really looking forward to his session ‘The Security Cookbook.”

Rick Borup is one of my personal favorite speakers at VFP conferences and is the co-author on Deploying Visual FoxPro Solutions. His session on “Automating the Build” is something I plan on attending.

Rod Paddock has hosted the often overlooked FoxForum.com site, which is where I hang out daily. Rod is an accomplished developer in both VFP and .NET so his session on “Understand the .NET Framework” should be a good one.

What a great set of additions to a power packed line up!

I also see Bob has announced each attendee will receive $150 in DBi Dollars. What a fantastic offer from the folks at DBi Tech. DBi Tech has been involved with the Fox Community for years, but have really stepped it up in the last 12 months with the Sedna components they are planning to release as part of the product and now this generous offer. Way to go DBi Tech and Bob!

Looks like Southwest Fox is heating up even more to be the best valued conference of the year here in the USA. I am sure there is not better bang for the buck in conferences around. You still have a couple of weeks to get the lowest price available. And knowing Bob, he probably still has a few tricks up his sleeve.

(updated 06/20/2006 to remove Milind’s speaking as Bob has removed him from the list in latest post)

Jun
14

Lost in Trace

I have a situation here that has me perplexed. I build an APP file, the VFP Builder Manager (Builder.APP) to be specific. I do a Recompile All, and have checked on Debug Info and unchecked Encrypted in the Project Info dialog when I build.

I have added a SET STEP ON in the code to figure out a problem I have with a new builder I am writing. When the Trace Window opens there is no code displayed. None. It is as if the Debug Info was checked off.

I have checked the code for SYS(2030) and there are no instances of this called in the project. There is no SET DEBUG OFF anywhere in the project. The FXPs are not readonly and not getting replaced because the code stops on my SET STEP ON. I have checked this with PROGRAM() and LINENO() in the Watch window and they match my additions to the Builder.PRG. No projecthook to reset the Debug Info setting. I even added a SYS(2030,1) to make sure VFP was not stopping the debugging internally.

I know I am running the correct version of the APP file by checking _BUILDER and doing a ?FDATE(_BUILDER) to see if the file is the correct build date.

As you probably know, I don’t have much more hair to pull out.

Has anyone seen this before? Can anyone point me to the corrective action? There could be prizes!