Sunday, June 22, 2008

VFP: Include Config.FPW in EXE

I was working with one of my clients a couple weeks ago and he asked me my thoughts on using a Config.FPW with a VFP app. I mentioned I include one with every application I deploy and sometimes two.

The first one is brought into the project, marked as included, and compiled inside the EXE. Some Developers shy away from this technique because it makes the Config.FPW read-only and this sort of defeats the purpose of a configuration file. This was true in VFP 7, but since VFP 8 was released you can have more than one by including the following line in the Config.FPW:


You can include a Config.FPW file in the application folder to override any of the settings. Visual FoxPro gives the external file priority. Here is my default Config.FPW file I start with for all my applications.

* Default Configuration file for application
_FOXREF = ""
_GENPD = ""
_WIZARD = ""

You might be wondering why I have a bunch of the system memory variables blanked out. I cannot recall where I read it, but this helps a run-time application start faster because VFP is not trying to find the IDE tool locations determined by the system memory variables. This has been an old trick from a long time ago. We are probably talking nanoseconds of savings because VFP is very fast, but I only really had to type these in once.

So my client implemented my idea in his app and called me back to tell me I was nuts because it was not working. Crazy talk, I know I have been using this for years. I asked him if the file was marked included, and if there was actual settings in it and he proclaimed yes. So I connected up to his machine to see what was up. He included it in the Programs section, not the Text Files section in the Project Manager. Took me about 30 seconds to figure this out and he was back in business.

I do find it interesting that Fox cares about this as I always thought it was the file name extension that mattered, but apparently the section you include the file under does have an impact on how it is treated. Good to know (and share with all of you just in case I am not the last developer to learn this {g}).

I have read where some developers are using this file to SET REPORTBEHAVIOR 80 so they can move their apps to the VFP 9 runtimes without needing to change their source code. I have an application object that calls an environment settings object to make most of the SET commands the way I like or need them for my applications. Alternatively you could set them in the Config.FPW, I just don't use it this way.

I also read something interesting this week about the Config.FPW file that I had not considered before, but if you include a Config.FPW file in the same folder as the Visual FoxPro OLE DB driver it will use your customized settings. I have not had a whole lot of use for the OLE DB driver in my Fox projects, but it is good to know in case I do have the need to do so in the future.

What techniques are you using to help me build a better default Config.FPW?


Thursday, June 19, 2008

Firefox 3 - Wait and See

As I mentioned in a post last week, I am less inclined these days to install the latest and greatest of every piece of software I use. To me, a lot of software manufacturers have moved their products into a perpetual beta. While I understand the need to move things to market quicker and be first with new innovations, in general it seems to me software is pushed too fast and users suffer the consequences. I am sort of burned out in this respect, and don't have time to spend finding the problems. I am in the part of the cycle where I can watch others move out into the waters before I do for most software updates.

Upfront, I can state that Firefox has been my primary browser for the last few years. I rarely use IE7 except for the frequent visits to I like it. The only issues I have is the latest build locks up on me as I am surfing (likely a conflict with an add-on), and it is a memory hog. Both issues are allegedly fixed in the newest release.

I downloaded Firefox 3 during the download fest to set the Guinness Book of World Records. I hope they get the record, even if I am not sure how it is really measured.

I have not installed it yet. I was thinking about it, but everything I have read is polarized from its great, to it sucks. Not much in the middle. Performance is terrific, performance stinks. Fast rendering, slower rendering. Interface rocks, to what the heck did they do to the icons. Address bar features are cool, address bar features make it unusable. Some will never look back, some have uninstalled and moved back to 2.0.

Across the board. Blogs, Twitter, emails from friends and customers, and expert analysis. Polarized.

I likely will take some time in the next week to load it in a virtual machine. No sense in hosing up the production box. What are your experiences? Like it? Hate it? Sitting on the fence and watching the game like me?

Labels: ,

Twitter Honeymoon

I am finishing the second full day of learning about Twitter and how this thing works. Observations so far:
  1. An interesting mix of characters makes it enjoyable to listen in. I definitely see the water cooler benefits for the folks working on their own. I have been out of the team and office environment for more than a year and miss the camaraderie.
  2. So far it has not been as distracting as I anticipated.
  3. Getting an applet to get tweets is definitely the way to go if you want to keep up with things. Turning it off is easy to do. Right now I am using twhirl because it seemed the most popular of the people I follow. First Adobe Air product I have used.
  4. Learning to write in short sentences is not as easy as I thought it would be.
  5. Short sentences not easy {g}.
  6. I am learning about FireFox 3 from several people jumping in the pool before I do.
  7. I am surprise to see Twitter put up pages about how it is too busy and to try later. This happens a lot. I would expect it to be scaled by now.
  8. Guy Kawasaki is a twittering madman and often off the wall. Different person than what you read on his blog.
  9. Alan Griver is a soda junkie, or it seems his day revolves around the choice of beverage he partakes in at work. I actually had a craving for a Coke the other day. Have not had one of those in a long time. I have been off caffeinated beverages for two and a half years.
  10. Craig Bailey is a caffeine junkie and has a new coffee maker in the office he worships.
  11. Rick Strahl actually takes vacation. I am surprised that this surprises me.
I am still not 100% sold on Twitter, but I am definitely not disliking it either. Time will tell.


VFP and heart stoppage

I can probably count on both hands and feet the number of times I have literally sworn at Visual FoxPro (that would make it an average of once a year). Today was one of those days. I have been working on a new solution for one of my customers that needs to send email. I have tried several techniques with emailing from FoxPro over the years (Outlook Automation, CDO, West Wind wwIPStuff, Shelling out a MailTo, and most recently Craig Boyd's Extended MAPI FLL, and Blat). The swearing has nothing to do with any of the email techniques, but I can say working with email does cause hair loss.

The situation that caused me to swear today was one I have never seen before, and honestly cannot explain how it happened. I was working with a set of classes. One parent class (abstract) and four different subclasses with all the different implementation scenarios. I was using the Class Browser to work with the class library. I instantiated the child class like normal using a NEWOBJECT(), and then called the SelfTest method I have setup to run through different test scenarios I have to verify the code works as designed. I found the problem I was tracking down in the debugger, canceled out, and opened up the subclass.

This is when the twilight zone moment happened. When I opened the class all the source code for the class was gone. I mean gone, as in zero property settings, and no method code. I closed the class and opened it again. Same thing. Holy S&^*&&*t! (sorry, but I have to tell the whole story). A complete morning's worth of stream of conscious coding out the window. I tried to open up the parent class and got the message that the class was in use. Weird.


Yes, I know the commands have some redundancy, but one can never be to sure to get the cleanest environment. Back to the Class Browser and still no luck opening the parent class: still in use. Visual FoxPro has a way to hold on to classes when I least want it to. Time for the FoxPro flush (not the FLUSH command, rather, QUIT and restart). Opened up the Class Browser and my subclass and there it is in all it's glory, the source code for methods and properties are back to normal. Relief.

So I backed up the class library and finished up the documentation in the classes and called it a morning. Hopefully the stress of potentially losing the source code made me stronger since it did not kill me (this time at least).


Wednesday, June 18, 2008

SnagIt 9: Must have software

I know a lot of you reading this post are fans of TechSmith's SnagIt. TechSmith released the new version a week ago and I upgraded my production machine over the weekend (only US$19.95). Simply said: SnagIt 9 rocks! I was not sure exactly what TechSmith could do to improve what I think is a nearly perfect product, but the folks over in Okemos Michigan obviously listen to their customers and have added some terrific stuff.

Over the years I have become more and more reluctant to installing newly released software, but I did not hesitate to do so with SnagIt 9 despite being in the middle of a number of projects including a new book, a regular column in FoxRockX, and using this tool to write specs and user documentation. In short, I cannot afford to lose SnagIt stability. TechSmith did not let me down. In fact, they have made my life better with the newest release.

My favorite new feature is the revamped SnagIt Editor and the ability to work with multiple images. When I am working on an article, chapter in a book, white paper, or user documentation I like to do some side-by-side images. Previous to this release I had to take the images separately, save them, and use something like MS Paint or Paint.NET to merge them together. Now I can take a couple of snags and use the editor to work with as many images as I can capture. No more one-at-a-time. This editor allows you to drag-n-drop images from the Open Captures Tray to the Canvas. Nice.

Speaking of the SnagIt Editor, I think they have implemented the ribbon control perfectly. I will admit, when I first saw the ribbon control demonstrated in Microsoft Office a couple of years ago I was skeptical. I adapted to it quickly in Microsoft Office, but even today I occasionally run into something I struggle to find. This is not the case with the SnagIt Editor. I have found everything I have looked for and it is exactly in the place I thought it should be. For instance, instead of the blurring and edging features being on individual panes in the task pane (how it worked in SnagIt 8), they are together on the Image tab of the ribbon. Same for the rotate, resize, crop, cut out, resize, border, etc., etc. The old task pane kept switching back to the main after each effect was used, but now the ribbon stays put. The list of graphic editing capabilities keeps on growing.

Speaking of the graphics capabilities expanding, I also really like the perspectives effect. Very easy to use and lots of options.

I have already started using the new tagging feature inside the Search Pane. Very cool and very powerful. There is the ability to save your own keywords, but I am using the built in flags (important, bug/error, follow up, funny, personal, financial, idea, sent, and cool) more. What images came from Visual FoxPro, FireFox, PowerDesk, etc. Now I can search the images I have captured by any of these settings.

There is one bug I have come across, but it is already solved by the developers. Occasionally I would see the Invalid Argument messagebox pop up when grabbing an image. Only way out was to kill the app via the Task Manager. One check with the tech support site shows a fix is already ready. I have not seen the message since I installed the updated SnagIt Editor fix.

I am sure there are other new features I have not even looked at and will be using down the road, and I am looking forward to discovering them. Great user interface, great work flow, great product.

Labels: ,

Tuesday, June 17, 2008

My new desktop image

The latest pictures of the International Space Station complete with new Kibo lab and European Automated Transfer Vehicle (Jules Verne) are posted. These were taken by the astronauts on the Space Shuttle Discovery during STS-124 mission.

Here is the newest picture on my desktop for those who are interested:

photo missing

Spectacular shot. Wish I was spending some time there for summer vacation. Only US$25 million left to save {g}.

Labels: ,

Tweeting on Twitter Twooo

After listening to a couple of friends swear it is not another potential BIG distraction, and being prompted by an email notification from Hentzenwerke with Whil's take on Twitter, I have decided to listen to the chirping. At least give it a try for the short-term. New methods of learning is what this is all about. If I learn this is a waste of time, I still have learned something.

If you are interested in my brief ramblings, you can find me on

In case you are wondering what "tweeting" is, I posted the description on the ProFox list back a couple of weeks:

"Tweeting" is what Twits do when they post on Twitter. {g}

And for the record, I do not expect this to take away from the blogging (not that I have been doing much of this lately either with my crazy schedule). Blogs are way better in my opinion because I can explain things in detail when I have more than 140 characters to write.

Labels: ,

Thursday, June 12, 2008

VFP Reporting Tip - paying it forward

I was mentoring one of our clients this morning because of a reporting issue he faced with some weird truncating labels (not that this tip is of any help for his problem {g}). During the session he showed me this new wiz-bang function he created to concatenate text together to be displayed on the report. He mentioned how his function removes the missing details from a snail mail address. You know the drill, customer wants to track address line 1 and 2, contact name and company name, but only wants to print the things that are filled in.

I turned around and told him about his new friend the semi-colon (;). This is a trick I learned back probably in FoxPro for Windows or even DOS when I was creating labels for customer mailings. You first drop a textbox on the Report/Label designer and size it to show the max lines you will print based on all the data being entered in the record. You can add the expression like this:


The semi-colon acts as a carriage return and any columns in the expression that are empty are not printed and if the line is empty the carriage return is not included. The commas (,) outside of a quote are replaced by spaces. So you can see how I am concatenating the city, state, and postal codes for a line.

I know this is an old trick and tip, but my client has been using Fox of some sorts for a long time too so in the case where you did not know this I am hoping it will be helpful. There are so many little things like this I take for granted that everyone knows, but realize in working with other Fox developers that this is not always the case. I also wonder from time-to-time how many little tips like this one I don't know about.

Labels: , ,

Thursday, June 05, 2008

Red Wings Bring Stanley Cup Home

It has been a very emotional time for hockey fans in Detroit, but tonight the Wings win Game 6 and clinch their 11th Stanley Cup - 4th in the last 11 seasons. The most traveled trophy in all of sports makes its way back to HockeyTown.

I think the last six games have been some of the best hockey I have seen in the last few years for sure, and maybe ever. Heart-stopping plays and continuous action makes it hard to work while the games are on. I was at my daughters final band concert this evening and missed the first period. Fortunately we had Internet on the phone and could keep current with {g}. I actually watched the rest of the game and only hit the computer during the intermissions.

I think Red Wing's coach Mike Babcock made a statement that really shows how lucky the Wings are and how good a team they are - he said that when you switch goalies in the first round it normally means they are going fishing in a few days. Meaning you are usually giving up. This team was not giving up.

Most memorable moment for me is the almost goal with less than 3 seconds left in game 6, and how Osgood shuffled it away, and how sheer physics kept the puck momentum from hitting the net. I was having a flashback to game five and was dying thinking we might be going to another triple overtime. The other was when Zetterberg tied up Crosby as the puck skipped by the goal post in the fourth game. Third moment was Zetterberg's last goal that literally squirted through the goalie's legs and was pushed in - heartbreaking if you were a Penguin fan. The hits, the pinpoint passing, bad ice, a broken nose, hamstrings strung, post-clinkers in close games, pulled goalies, last minute goals, and octopus on the rink. Fantastic hockey by both teams.

Thanks Pittsburgh, if the Wings we not going to win it I cannot think of another team I would have enjoyed watching win it more. I would not mind playing this team for years to come.

Mary - you are off the hook. You were right in the end - the extension of the series allowed us to watch more great hockey. Terrific stuff if you are an adrenaline junkie.

Wings win, Wings win, Wings win!!!! HockeyTown rocks again. What a ride.

Labels: ,