Tag Archives | FoxPro

Hacking WordPress with Visual FoxPro

My first attempt at importing blog postings from Radio Userland to WordPress resulted in over seventy categories. Every post with a different combination of categories like “MySQL; LAMP; Technology; Security” created a new category with that exact name, rather than a one-to-many post-to-categories representation. WordPress supports this, as does Radio. The communication breakdown occured between the two, in an export routine I used that created MT-compatible text files.

I could have kept experimenting with different imports, but I’d rather just plow ahead with what I’ve got, so I took a look at the WordPress schema and figured out what I’d need to hack. I used Visual FoxPro to read in the category table, figure out which (multiple) category posts I should have instead of the single, multi-category category, and rewrote the many-to-many file that joins the posts to the categories.

That narrowed it down to 15 categories. I added a new one, “Personal” for notes about politics and personal goings-on. I hope to squash the four, now three “My” categories, which are the old example categories left over from the original Radio install. Stay tuned!

I noted the counts of the number of posts per category was showing zero for several categories. There’s a (denormalized) category_count field in the category table. I popped open phpMyAdmin on the server to poke around and finally issued a “update wp_categories set category_count = (select count(*) from wp_post2cat where category_id = cat_ID)” to get the counts to update. Thirteen rows updated in 0.0635 sec. Darn near as fast as Rushmore.

About Ted Roche

A picture named tedr.jpg

Last good picture, 1997-ish

An independent consultant specializing in web site development and database-centric software development, co-author of 4 books, contributor/editor to another six. Work web is http://www.tedroche.com .

Currently, working on Ruby on Rails, PostgreSQL and MySQL databases, jQuery and occasionally a bit of PHP. Certified MySQL Developer (CMDEV) for MySQL 5.x (2008), Core Certified in MySQL 4.x. Former Microsoft Most Valuable Professional, 1994-2002, Microsoft Certified System Engineer and Microsoft Certified Solution Developer, first certified in Windows 3.1. Passed 17 exams, 1994-2000.

Senior Member of the Association of Computing Machinery, Member,  Electronic Frontier Foundation, American Civil Liberties Union and many other organizations.

Former member of Greater New Hampshire Linux User Group, New Hampshire Ruby Group, Alphaloft Community Supporter, Python Special Interest Group, Seacoast WordPress Developers GroupNational Writer’s Union, Boston Computer Society, Foxboro Area Common Users Group and many other organizations.

Books:

Contributing Editor to FoxPro Advisor magazine. Fifty columns of “Ask Advisor” or “Advisor Answers” published 1995 – 2000, along with a dozen feature articles.

Currently an independent consultant and head of Ted Roche & Associates, LLC – http://www.tedroche.com. We develop Visual FoxPro solutions, and work with clients as mentors, trainers and developers. Other tools include Microsoft SQL Server and Visual SourceSafe, the Oracle family of databases and Free/Open Source Software like Linux, Apache, MySQL, PostGreSQL, Python, Subversion, Twiki and Zope.

2000-2001: Worked at http://www.bugcentral.com before its parent did the Chapter 11 thing.

1995-2000: Worked at Blackstone Data Systems, who also managed to tank during the dot-com bomb. A great group, a great learning experience.

1995: New Hampshire Health & Human Services as a support technician while finishing “Hacker’s Guide to Visual FoxPro 3.0”

1992-1995: A brief employment at Brickstone Square in Andover, MA., followed by independent consulting, including Kronos and New England Computer Sales (NECX, since purchased by VerticalNet).

1989-1992: Software Developer for AINetwork and New Hampshire Insurance, part of AIG. Worked on a mailing label system for tracking attendees to the golf tourney that eventually turned into the most powerful and accurate P&L in the entire company. Scope creep. PCs and Fox had a tendency to do that kind of thing. Eventually wrote the report that proved the company would never make money, and they closed. Sure hope I was right. I was among the hundreds laid off.

1987- 1989: Worked for the Massachusetts Department of Public Health, Division of Food and Drugs. Moonlighted evenings and weekends at “The Memory Location,” Washington Street, Wellesley, MA, selling Commodore 64, 128 and Amiga computers, peripherals and software. What a blast! Great fun, cool stuff, great bosses – Don Towne and Roy Lee.

Also volunteered for the Foxboro Area Commodore User Group as President, BBS SysOp and newsletter editor. BBS was a blast: 300 baud modem, Commodore 64, an SFD-1001 IEEE-488-interfaced One-Megabyte! 5-1/4″ floppy disk. Beta-tester for GEOS Software. First public-domain (pre-Open Source) software release was a quad-density Epson printer driver hand-coded in 6502 assembler. Owner of Commodore Amiga 500, 1000 and 2000. So much for future visions!

Ten year member of the Boston Computer Society. RIP.

Bachelor of Arts in Mathematics, 1984, from the Regent’s Program of the University of the State of New York, renamed Regent’s College and now Excelsior College. Associate of Arts degree in Liberal Arts and Sciences from Mohegan Community College, now Three Rivers Community College Norwich, Connecticut. Both degrees earned while serving in the U.S. Navy full-time.

626patch.gifUSS Daniel Webster.jpg1979-1987: Served as an Electrician’s Mate First Class, EM1/SS, Submarine Service. Ten deterrent patrols aboard the USS Daniel Webster, SSBN-626, Blue Crew, 1981-1987.

NPTU Ballston Spa, New York, winter of 1980-81.

Naval Nuclear Power School, Orlando Florida, 1980. Top electrician in my graduating class, 3.94 GPA.

Boot camp, Basic Electricity and Electronics, Electrician’s Mate “A” School, Great Lakes Training Center, Chicago, Illinois, 1979-1980.

Crosbro, Inc., 1978-1978: shipped my first commercial applications (order processing, inventory control, work-in-process tracking) written in BASIC on WANG 2200-A, T and VP computer systems. 16 kB RAM, BASIC in ROM, Key File Access Method (KFAM) as an ISAM database.

Bates College, 1976 – 1978. Teletype terminals, PDP-8 and 11, time-sharing with Dartmouth College. BASIC and beta-tested SBASIC – structured basic, without line numbers! – on the Dartmouth system.

Brockton High School, 1972-1976. Swim team, 3 letters, National Honor Society. Learned BASIC on a PDP-4.

New E-book: VFP Best Practices for the Next 10 Years

Over at Shedding Some Light, Rick Schummer blogs VFP Best Practices E-book Available “Have you read some of the blog or forum posts touting the sessions at GLGDW 2006, and kicked yourself for not attending? Wish you had a second chance? Well Whil is giving you a second chance by releasing the session whitepapers as a new e-book: Visual FoxPro Best Practices for the Next Ten Years

What a great idea! I wish more of the conferences would offer their proceedings in electronic format! There is so much knowledge in those conference notes. While it’s nowhere near as good as attending the conference in person, these notes can be treasure troves of clever code and solutions.

Library Thing

I’ve added a sidebar to the blog showing off some interesting books from my library. LibraryThing.com has an interesting proposition: post your library online and share your book lists with others, tagging included. The Dartmouth/Lake Sunapee Linux User Group is maintaining their list of library books for loan on Library Thing, so I thought I’d try it with a barcode scanner/keyboard wedge I picked up at Hosstraders over the weekend. Looks like Library Thing is a cool application. I see Rick Borup is already posting FoxPro books up there, and I added my Hentzenwerke collection as well. Check out their tag cloud and the ability to subscribe (via RSS, of course) to tags, other people’s lists, topics, etc. Looks like fun.

SMTP Good; MAPI Bad

For years, I’ve endorsed the idea that using a simple low-level protocol was far easier to troubleshoot and maintain than the high-level, proprietary and hidden-from-view COM interfaces that were all the rage in the Windows world, hence, “SMTP Good, MAPI Bad.”

Laura and I support a vertical-niche application in use around the country. Each of the installations runs Visual FoxPro 7 as a LAN-based application and sends faxes via email using MaxEmail, rather than supporting their own in-house faxing system. On a regular basis, one of our clients will change email providers, so the settings for email are stored in a separate file for easy update.

“Easy,” though, is a relative term. More email providers are requiring authentication before allowing outgoing emails, a reasonable precaution against spam. However, each installation of SMTP AUTH we have run up against has a slightly different variation on how authentication is done, and invariably, email stops until we analyze, debug and modify our code to support the new variation.

I’ve used the free BLAT command-line tool with it’s -debug switch to allow me to witness the actual conversation that takes place between email client and server to determine the details of where the conversation is breaking down and how to fix it. Open Source rocks! BLAT rocks!

In this last case, the new email provider’s SMTP AUTH required a user name (“bob”) and not an email address (“bob@example.com”) as the user name. The previous SMTP AUTH interfaces were comfortable with the same name for email address and user name. Laura tweaked the code and we got the client back up and running.

UPDATE: Thanks to Alex Feldstein for the pointer. In fact, we too are using Rick Strahl’s wwIPStuff, now renamed West Wind Client Tools as the machanism within the application to send SMTP mails. We’ve just used the standalone BLAT for its great low-level debugging facilities and ease of use from the commandline to figure out what to tell wwIPStuff to do.

Ziff-Davis notices FoxPro and Sedna

Microsoft Watch from Mary Jo Foley reports FoxPro Faithful Await Microsoft ‘Sedna’. “This week, FoxPro developers received a first test build of a new set of technologies, code-named Sedna, designed to make FoxPro interoperable with Windows Vista, Office 2007 and .Net.”
“Visual FoxPro developers, oft-overlooked by Microsoft, are about to get an infusion of new technologies aimed at making the FoxPro language interoperable with Windows Vista, Office 2007 and .Net.”

The State of Dabo, 2006

Ed Leafe, well-known in the FoxPro community as a former MVP and proprietor of the ProFox mailing list and OpenTech web sites, is speaking this weekend at the U.S. Python Conference on “The State of Dabo, Where we’re at, February 2006.” For those who haven’t seen it yet, dabo is a framework for rich-client, multi-tier, database-agnostic software development, similar to what Visual FoxPro promised. dabo runs on Mac OS X, Linux and Windows. The white paper looks great! At PyCon last year, Ed’s presentations were ranked highly. Wishing him great success this year as well!

Google Print and Hentzenwerke

Just to clarify that last post. Mike Sullivan pointed out that Google is posting pages from Hentzenwerke books with the publisher’s permission and/or cooperation. Google is not infringing on my copyright by doing this. I signed over the right to publish my books to Hentzenwerke, with some limitations, and I believe this is within those terms.

I’ve wanted to get Hacker’s Guide to Visual FoxPro on to the web for the past couple of years, but the publisher and authors couldn’t work out the mechanism. Google has solved that problem, at no cost to us. For some books, it’s possible this will lead to new sales. For others, it can make the work more accessible, perhaps elevating the reputation of the authors, leading to new work, which is the motivation for many technical authors.

Technical books face some unique challenges. Frankly, Sturgeon’s Law dictates that 90% of all technical books are crud. Technical books may even exceed that standard. But the grueling effort of assembling a complex technical book or reference book will have a challenging economic model: will publishers want to advance authors money to write a book that people will read for free on Google? You gotta read a novel from cover to cover, but you usually only need to read a single topic in a reference book. It will be interesting to see how this plays out in the marketplace. For the moment, I’m not inclined to invest a lot of effort in another reference work.

Linux Certification

Over at Linux Watch, Stephen J. Vaughn-Nicholls opines “You don’t have to have a Linux certification to get a job working with Linux, but it can’t hurt.” I’m a big fan of certification, as I think eventually the vendor- and industry-level certification will be viewed as Continuing Education requirements for Licensed Software Practitioners. I’ve lectured about this years ago. I’ve also practiced what I’ve preached, earning a Novell CNA, Microsoft Certified Professional, Certified Solution Developer, Certified System Engineer and MySQL Core Certification through the years. I also worked as one of the lead authors for Microsoft’s Visual FoxPro 6.0 Distributed Applications exam, so I appreciate the difficulty of creating a legitimate certification.

Like a diploma, some certificates may just be an attendance report crossed with a good deal of bulk memorization, but it also shows a willingness to work within the system. A four-year degree generally indicates a bit of patience, too. But on the flip side, remember what they call they guy who graduates at the bottom of his class in med school: “Doctor”

Certification can be what you make of it. An educational opportunity, a means of self-evaluation, and a chance to distinguish yourself in the marketplace.

Time for a new toolset?

Listening to the Gilmor Gang podcast yesterday (great discussions on Windows Live, conversation with Robert Scoble, and Doc Searls nails it once again), one of the panelists mentioned Eric Von Hippel’s work on “user-driven innovation” that had been featured in a podcast of Michael Tiemann’s presentation at the last MySQL conference. Michael also mentions Von Hippel’s work and his HBR article (May 2002, if memory serves) in his presentation on “The Open Source Triple Play.”

It’s a vast simplification to summarize Von Hippel’s work as “give the users the tools and they will solve the problem” but much of the work on Von Hippel’s site (including video tutorials, two books under the Creative Commons license, and articles – bravo!) points towards that theme. Well worth a look.

FoxPro developers can recognize similar patterns in our ability to embed tools such as Stonefield Query and FireFox! inside our applications, allowing the users to develop the complex reports that lets them run their business and extend the reach of the application. Gilmor Gang members were speaking more of Web Services and AJAX and extending services such as Google Search, Maps, Yahoo! and Microsoft offerings. The scale changes when you move from offering tools in a proprietary application to exposing these tools to the entire World-Wide Web.

Provide users with easy-to-use tools and they will build the solutions they need. Isn’t that what fired up the PC Revolution in the 80s? Isn’t that what real innovation has always been about?

“Man is a tool-using Animal. Nowhere do you find him without tools;
without tools he is nothing, with tools he is all.” — Thomas Carlyle

“A small group of thoughtful people could change the world. Indeed,
it’s the only thing that ever has.” — Margaret Mead

Exciting times.

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.