Jan
03

MAKETRANSACTABLE() use

Each time a new version of VFP is released I look at all the new commands and functions to see how I might be able to incorporate them into my user applications and developer tools. Each time I have found some function or command that makes me scratch my head and wonder what the Fox Team had in mind. For VFP 9 this was MAKETRANSACTABLE().

At least this is how I felt about this command up to a month ago. I received a new mini-project from one of my clients who needed a basic import of some accounting data from an external program into their custom app. The external table was a free table created and/or updated by another program. The new records needed to be imported into another DBF contained in a database container. Once the records are imported I needed to stamp them as imported in the free table. Hmmm, sounds like something I would want to do inside a transaction, but I have this free table… ah, finally the perfect reason to use MAKETRANSACTABLE().

The funny thing about this is I have never tried the new command to see if it works {g}. It is rare for me to work with free tables in a production environment. Normally I work with SQL Server, or VFP contained tables.

So I tested it out and it does indeed work, and it works well. The odds of the import not working is very, very remote because I am only adding the new records to the database table (no updates of existing records), but I thought the extra security of doing it inside a transaction was worth the extra couple of commands to add to the code.

Here is some of the code so you can understand fundamentally what I did.

TRY  USE (toParameter.cFeedFile) IN 0 EXCLUSIVE ALIAS (toParameter.cFeedFileAlias)  SELECT (toParameter.cFeedFileAlias)  INDEX ON TimPe TAG TimPe   * Allow the free table to work in a transaction

  MAKETRANSACTABLE(toParameter.cFeedFileAlias)

 * Set buffering so entire table gets updated or can be reverted  CURSORSETPROP("Buffering", 5, toParameter.cFeedFileAlias)  **** Open other tables...

CATCH TO loException  toParameter.lOpenedAll = .F.  toParameter.cTableUpdatedFailureMsg = "Failed opening tables - " + ;                                    loException.Message ENDTRY

*** Handle processing of tables...

* Start a transaction so all changes can be backed out.

BEGIN TRANSACTION

toParameter.lDatabaseFileTableUpdatedResult = ;TABLEUPDATE(.T., .F., toParameter.cDataBaseFileAlias)

IF toParameter.lDatabaseFileTableUpdatedResult * Continue on with the feed table update  toParameter.lFeedFileTableUpdatedResult = ;  TABLEUPDATE(.T., .F., toParameter.cFeedFileAlias)   IF toParameter.lFeedFileTableUpdatedResult * All changes committed    END TRANSACTION  ELSE * Record why    AERROR(laError)    toParameter.cTableUpdatedFailureMsg = laError[2]  ENDIFELSE * Record why  AERROR(laError)  toParameter.cTableUpdatedFailureMsg = laError[2]ENDIF 

* Determine the way to finish up.IF toParameter.lDatabaseFileTableUpdatedResult AND ;  toParameter.lFeedFileTableUpdatedResult * All went well and is commitedELSE  * Problems and rollback  ROLLBACK   TABLEREVERT(.T., toParameter.cDataBaseFileAlias)  TABLEREVERT(.T., toParameter.cFeedFileAlias)  toParameter.nRecordsInserted = 0 ENDIF

RETURN

I think it is cool when there are others that have a vision to incorporate things into Visual FoxPro that hit me years later how I can use them.

Jan
03

This is slightly off topic, so if you don’t want to read a rant about Michigan and the idiots who run this state: move along to the next blog. If you want to understand how hard it is to run a software development business or get a better understanding of what your employer faces from time-to-time, read on.

Running a high tech business in the state of Michigan is hard enough without being impacted by people in government who most likely never ran a business. Companies are closing up all over Michigan and a lot of the reason is Michigan is suffering through a one state recession. While the leadership in Lansing cannot be blamed for the decisions of companies like GM, Ford, and Chrysler for laying off more than 100,000 people, I do blame them for the decisions made that are further hurting the state economy. Here is a fine example.

White Light Computing has been in business for nearly four years. During this time the company has paid unemployment insurance at various rates based on the length of time the company has been in business. The first two years the rate was 2.7% for the first US$11,200 of salary, and last year it dropped to 1% based on the fact my company has not pushed a single person on the unemployment line. As a reward for this, as White Light enters its fifth year (according to the state 2008 is year five) the company gets a 50% increase on unemployment insurance. This means an extra US$56 per person on the payroll. While the impact is minor to White Light Computing, imagine being a restaurant owner with lots of lower wage employees and getting a 50% increase just for surviving the first four years in the nations worst economy. How about automotive supplier who already has the slimmest of profit margins to work with and a huge staff on the assembly line?

The people who run this state are complete morons. I called the agency in charge of increasing my rate and their only defense was “it is only a half percent increase, not a 50% increase.” And people say they will never use the math they learned in school. Sheesh.

Dec
30

Time Waster Alert!

http://blueballfixed.ytmnd.com

Mindboggling.

Dec
28

Fox Rocks with FoxRockX

The publishing industry in general has faced some troubling times in the last couple of years. This can be witnessed in spades in the Fox Community as we have all watched both FoxTalk and The Advisor Guide to Microsoft Visual FoxPro literally go away. FoxTalk is still published, but is continuing printing the “best of” articles. Advisor collapsed the majority of their technical magazines into Databased Advisor and nearly tripled the price. Both of these situations are sad. I still have active subscriptions to both publications, but I do not intend to renew either of them.

So this leaves a huge gap in the community. There are authors who are getting jittery with extra time on their hands each month and no outlet to get articles published. They could resort to blogging, but long blog entries are not fun to read (at least to me), and often hard to take with you to the reading room, or on a plane or train. More importantly they are not necessarily permanent. Bloggers change services, RSS feeds only hold so many posts, and the authors have the right to pull their posts. Magazines (paper or electronic) are delivered to me and I can keep them as long as they are useful.

It would be nice if there was a publication that would focus on FoxPro. A great magazine the entire Fox Community could subscribe to for state-of-the-art and timely information, and techniques for our favorite development tool and language. I would subscribe in a heartbeat.

Rainer Becker, the newest Lifetime Achievement awardee is stepping up and creating a new magazine called FoxRockX (pronounced Fox Rocks). He has convinced some of the regulars you have come to enjoy reading to produce some new content for this magazine. He has lined up some excellent regular topics on the Sedna extensions, VFP 9 SP2, VFPX, business topics, deep dives into development, Vista, extending with .NET, new tools, tips and tricks, Guineu, and is resurrecting the KitBox column. I am sure there are going to be many more topics as time goes on.

I am very excited by this development in the Fox Community and am glad I am able to help out with getting this magazine started. I have already sent in one article on VFPX and plan on doing more articles that deep dive into the various VFPX projects and tools being developed by developers in our community.

I am glad Rainer has been working on this because I was starting to plan again how to start my own venture in publishing I knew I did not have the amount of time and energy it was going to take and still keep White Light Computing running properly.

FoxRockX will have subscriptions in electronic and print (print is naturally more). All the details will be posted soon and the magazine will start in early 2008. Thanks to Rainer for heading this up and to all the individuals who are pouring their creative and administrative energies into this new venture. I hope everyone in the Fox Community can support this magazine. It will only be successful if people back it by subscribing to it as soon as they can. I hope Rainer can count on your support.

Dec
28

Sorry for the long absence from the blogosphere.

I am digging out of a huge backlog of customer work, recovering from a neck full of unaligned vertebrates (literally a pain in the neck) from a slip on the ice, working on some long avoided home improvements because of neglect, assorted hardware problems, wrapping up some to-do items for Southwest Fox 2007, working with conference center for next year, tiding up the office, and the inevitable onslaught of the holidays.

Heck, I have not even had time to setup the new Vista laptop that arrived a few weeks back. I did however connect my new Dell 24 inch LCD monitor (yes it is very sweet and highly recommended if you need extra light in the office {bg})!

I am also working on some cool new things for the Fox Community (more coming in the next blog post).

Happy New Year to all. I wish each of you a very healthy, extraordinary, and extremely prosperous 2008 with your favorite developer tools and environment, what ever platform you have chosen. Fox Rocks!

Dec
05

It is not bad enough that most Dilbert strips represent some past life experience I have had (or maybe something for my future), but now the guy is looking into my closet and blogging about it.

Read: Free T-Shirts

Today I am wearing a TechSmith SnagIt T-Shirt under my Southwest Fox Speaker sweatshirt. I am pretty confident that every t-shirt in my closet has some geek company or conference logo, and everyone of them were free.

Nov
20

FoxPro Content on Advisor

As you may know, Advisor has consolidated all their technical magazines into Databased Advisor. Life in the business world goes in circles and Advisor has come full circle if you recall the history of Advisor and their FoxPro offerings. It all started with Databased Advisor covering several database languages including FoxBase/FoxPro. The split the FoxPro content off into FoxPro Advisor, changed the name to Advisor Guide to Microsoft Visual FoxPro, and have now consolidated it back to Databased Advisor.

While I see some value in having access to all the content, to me at least it just gets in the way of finding the excellent FoxPro content written by the usual suspects (Christof Wollenhaupt, Tamar Granor, Pamela Thalacker, Andrew MacNeill, Ceil Silver (now Mike Lewis), Rick Borup, Rick Strahl, Doug Hennig, Andy Kramek and Marcia Akins) and the cast of others who contribute less frequently.

So I emailed Advisor and asked how I can see just the FoxPro content and they quickly responded with the following link:

http://my.advisor.com/wpubs.nsf/p/MSVisualFoxProAdvisor

(Updated 6-Mar-2008)
http://my.advisor.com/whome.nsf/w/MSVisualFoxProAdvisor

Much better.

Nov
19

Southwest Fox: New blog

While in Germany someone made a comment to me how they are looking forward to my blog returning to a FoxPro theme, instead of it being hijacked by Southwest Fox announcements. This is a really good point. So yesterday I created a Southwest Fox Blog so the three organizers can blog about our experiences organizing the conference, and things we are considering doing for the next Southwest Fox to open up a discussion on some new ideas. I hope you take time to subscribe.

Hopefully I will be blogging soon about the whole Southwest Fox Conference 2007 experience. I have so many great memories even though the conference was truly a blur.

Only 332 days until we all return to Mesa! {g}