Tuesday, October 20, 2009

CXToFRX

At Southwest Fox 2009 I showed a little utility that allows the creation of a VFP report based on the layout of a form or class. I had a need to do this quickly with several forms, so I whipped this up. All you need to do to use it is select the objects in the form or class designer that you'd like in a report, then run CXToFrx.prg and it will quickly create a report that matches the layout of the items you've selected in the form or class designer. This is a crude little utility that I whipped up for a specific need and it only supports textboxes, labels and editboxes at this point, but based on the oohs and ahs, thunderous applause and millions of dollars I've received in PayPal donations since I demoed it, it apparently has a lot of value.

In order to use it you have first create a report file named blankreport.frx in the folder where you place the CXToFrx.prg file. Enjoy...


Labels: , ,

Thursday, July 31, 2008

Rendering Blog Content to a web page

I received an email last night asking about how we render the table of contents from our blog to our home page. I thought this would make a good blog entry itself, so here it is.

Our home page is an Active FoxPro (AFP) page. It contains the code below to render the blog.

Someone just pointed out to me that this code wasn't showing up under ie. Bad ie!


?BlogFeed([http://feeds.feedburner.com/F1Technologies?id=]+DTOS(DATETIME()))
Blogfeed is a function I have defined in the .AFPA.Code file for F1Tech.com. I've attached the relevant code in a program named blogfeed in a zip file here.

In a nutshell the blogfeed class uses the Microsoft.XMLHTTP COM object to retrieve the URL, creates a cursor from it, locates the first record we want to render and then spits it out into an HTML table. I've used various versions of this class for a number of different blogs. The structure of the cursor created from the XMLToCursor call can vary widely and which record you want to start on will also vary, but this should be pretty easy to tweak to deal with that.

The id=DTOS(DATETIME()) parameter I'm appending to the URL is a dummy parameter. Feedburner doesn't do anything with this parameter, but I had to append something to force a new read. Without adding this the server (or something at feedburner maybe) seemed to cache the feed and it would take several days before new blog entries would show up. Using a GUID or a SYS(2015) value might be a better approach since those values would change on each call, but for my purposes, I don't mind if the feed is cached once a day because this should take a load off the server.

The BlogFeed wrapper function is designed for simple calls. The blogfeed class has a number of properties that are designed to make it possible to work with different blogs, use different styles and so on. Below are the key properties and methods you'll use to customize the blogfeed class for other content.

Properties
  • cBlogURL - The URL for the blog
  • cAlias - The alias created when the blog is loaded into a cursor.
  • nMaxEntries - The maximum number of blog entries to render.
  • nMaxNew - The maximum number of entries to flag as new. This property can be set to zero to specify no entries should be flagged as new.
  • nNewDays- The number of days to consider an item new.
  • cTitleField - The name of the field that contains the title for the blog entry.
  • cURLField - The name of the field that contains the URL for the blog entry.
  • cNewStyle - The style to use for items flagged as new.
  • cArticleStyle - The style to use for links to articles.
  • cErrorMessage - The error message to display when the blog cannot be read.

Methods
  • Render - Renders the blog as HTML
  • FindFirstEntry - Finds the first record to be written to the HTML table. Most blog feeds will create some header records that should be ignored.
  • GetEntryDate - Returns the date of a blog entry. Most feeds will contain a field that contains the date of the blog entry, but the format may vary greatly. This method typically is overridden to parse the date from this field.
The blogfeed class is a really simple class to make use of. I'm using AFP. The syntax for Web Connection should be identical. If you're using another web technology it should be fairly easy to adjust the call to the blog feed function as necessary. Enjoy! Somewhere around here I have calls for the VFP Wiki, VFPX, FoxCentral and a few other fox centric sites. I plan on deploying them all to a single page as a generic VFP portal sometime soon.

Labels: , ,

Monday, August 13, 2007

SW Fox Dispute Finally Settled!

Finally after months and months of bitter negotiations we've resolved our long standing dispute with Tamar Granor, Rick Schummer and Doug Hennig - the organizers of this year's Southwest Fox conference. Now that we've put that matter behind us we are pleased to announce that F1 Technologies will be sponsoring Southwest Fox again this year. As part of our settlement Rick strong armed us into providing a copy of Visual FoxExpress along with a free 6-month subscription for every registered attendee. Let me tell you Rick is one shrewd negotiator - Chester Karass could take some lessons from him. Even though we'll already be giving a free copy of VFE - a $699 value - to every attendee, Rick still "convinced" us into participating in the trade show as well.

The official deal is on Rick's blog. We'll let you read the fine print there in order to avoid another dispute with Rick. One thing Rick didn't mention, which in no way am I saying is an oversight on his part, is that we'll need a valid email address for each attendee in order to redeem this offer. When we return from Southwest Fox we'll be sending an email to each attendee with instructions on how to get their copy of VFE.

In addition to exhibiting Toni Feltman will be giving two sessions: "What's all this noise about OOP?" and "Introduction to the DBI Controls Included in Sedna." We'll also be holding a session to demonstrate the latest and greatest version of VFE - you know, the one each attendee gets for free.

Southwest Fox is a great conference. We're looking forward to participating again. We hope to see you there.

P.S. If you're wondering what the dispute was about, I'm sorry to say we'll have to keep you in the dark on that one due to the confidentiality agreement Rick made us sign. Maybe you'll be able to ply it out of one of us over a few beers at the conference though.

Labels: , , , ,