Archive | PHP

PHP: Hypertext Preprocessor? Hardly. A server-side languages for producing web pages, simply. Build it up into complex object-oriented frameworks. The workhorse for dozens of content management systems, blogging systems and web sites. Can build rich client apps, too.

Continuous Learning Curve: Javascript

I’ve avoided spending too much time delving into Javascript. My four-year switch from Windows-uber-alles (including VFP, VSS, SQL Server, Ingres, Oracle, HTML, OLE, ODBC, SCC, COM, XML, MCSE, MCSD, XSLT, DCOM, RSS, MS Office, Exchange, MAPI Bad, SMTP Good, MVP and more acronyms!) to Linux-Apache-MySQL-Postgres-PHP-Python-Ruby, not to mention XHTML, CSS, bash, Smarty, Django, TWiki, dojo, et al had kept me busy enough. But a new client assignment needs a highly-interactive web site and dropping in great big globs of someone else’s Javascript is not going to solve all the problems; at a minimum, I’ve got to be able to read it, debug it and tune it for the client’s particular needs.

Did you know that a limited version of Safari, the O’Reilly online library, is included with a membership to the Association of Computing Machinery? I’ve been an ACM member for years and been meaning to get around to trying this out. My Javascript studies seemed the perfect occasion. I’m reading Shelley Power’s Learning Javascript online and getting quite a bit out of it. I love when you settle down with a book and start going “Oh, is that what that meant?” or “Now I get it!”

Notes from MonadLUG, 10-April-2008: Guy Pardoe and Joomla

Sixteen people were present for the April Meeting of MonadLUG, the Monadnock Area Linux User Group meeting, held as usual on the second Thursday of the month at the School Administrative Unit #1 main office off Hancock Road in Peterborough.

As is usual with most LUG meetings, we spent the standard ten minutes wrestling with monitor settings for the cool new projector. We couldn’t do better than 640 x 480 so Guy was a trooper and persevered through the presentation at teeny resolution. Ouch. We’ll have to do some research to figure out how to get this new projector system to rock and roll.

Guy reminisced about his last presentation, (February last year) where he had talked about the new version of Joomla, which was due Real Soon Now and how he had promised to be back when it was released. In April of 2008, he was back to report that 1.5 is released, and the wait was worthwhile. In fact, version 1.5.2 is out now.

There was a discussion of the many new content management systems – Drupal is another one that’s received a lot of attention. Guy had also heard another one – ModX (http://modxcms.com/) that he hears all the cool kids are playing with.

Guy talked about how the web grew up in a table driven layout just to get positioning right, and that as css came along, that was prefered. Joomla templates are nearly always 100% CSS and valid HTML with few or no tables, and how there’s a lot of advantages from better accessibility, easier localization, better search engine optimization and fewer cavities.

As part of his presentation, Guy downloaded the .zip from the web site www.joomla.org, un-zipped the package, copied to an install directory, ran the installation (a pre-flight check, verified versions, etc.) and he was up and running (Joomla reminded to remove installation). Members noted that Guy showed them things about file management using the GNOME file manager that no one had bothered to try, since they would have all done it from a shell. Guy didn’t apologize for being a Windows refugee. There’s more than one way…

Guy talked about the first presentation of Joomla we saw, from Barrie North on 7 September 2006 at DLSLUG. Barrie has recently published a book, which Guy had with him and praised.

Guy gave us tour of the interface, both the public presentation and the administrative interface. Built-in default templates are pretty slick. The setup wizard was quite graceful. And addons and replacement templates seem to be available in huge quantities (Ted: downloading code off the internet and installing it to run on your computers without inspecting and understanding the code is a Bad Idea. Use only trustworthy sites and review what you get.)

Finally, Guy showed off a site he is developing for a client at Bristol Elder Care and talked about what was involved in getting the site up and running.

Thanks to Guy for a great presentation, to Charlie for organizing the meeting, to Ken and the SAU for the great facilities.

Check out NetVibes!

In searching for Prototype Windows and related JavaScript libraries to let us create portlets for a portal, we’ve run into a couple of pretty impressive contestants. The most recent is NetVibes, which appears to be both the name of the web site (“Build your own portal!” “Share it with your friends!”) and the underlying libraries and Universal Widget API specification. Very slick web site, very slick GUI libraries!

MonadLUG notes, 13-March-2008, Philip Sbrogna on WINE

Twelve people attended the March meeting of the Monadnock Region Linux User Group, MonadLUG, held as usual on the second Thursday of the month at the SAU 1 offices on Hancock Road in Peterborough.

Charlie called the meeting to order at 7 PM and we had the usual round of announcements. One member offered an HP LaserJet 4L and a new cartridge to anyone interested. There’s problems with the paper feeding, likely the rollers, and he didn’t have the inclination to fix it himself and went out and bought a new duplexing laser. If anyone’s interested, we can try to get you in touch with him.

Philip Sbrogna was the main presenter, speaking on Wine. Philip works as sysadmin for a local company, and has past experience as a game software developer (as well as a nuclear power
operator, a past profession we share) and is very interested in getting games working well under Linux. Wine Is Not an Emulator, but a API layer that provides the resources Windows executables need to run under Linux. The main page is at http://www.winehq.org and there’s a lot of information available there. Philip was running OpenSuse 10.x and demonstrated how easy it was to use the built-in YAST tool to locate, download and install a current and stable Wine release, version 0.9.42. Despite having practiced it several times, things don’t work the same during a presentation, and Philip was great about rolling with the punches and showing us how to configure, troubleshoot and tweak on Wine. We talked about the commercial alternatives, CrossOver Office from CodeWeavers and Cedega’s work with getting high-end games working, the Application Database at WineHQ where you can examine the list of programs known to work or known to have limitations and pick up suggestions on how to tune the application to your needs.

Ken got a chance to show off the new facilities of the meeting room. A new hi-tech podium’s in place that supports two projector screens, one of which is a touch-screen, dry-erase screen. The project supports computer video, TV tuner, DVD, videotape and a color video camera that can scan and preserve on memory cards,a 21st century opaque projector. Beautiful equipment! It may take us a while to learn the magic X configuration to get it working, so be prepared for a little struggling at the beginning of the meetings.

Next month, Guy Pardoe will demonstrate Joomla 1.5, the newly-released (and significantly re-engineered) content management system written in PHP. There’s a book on Joomla 1.5, written by Barrie North, who’s spoken at the Dartmouth – Lake Sunapee Linux User Group. It’s published by Prentice Hall PTR, an imprint of Pearson Education. Attendees to the recent CentraLUG meeting may recall we had a copy raffled away.

Thanks to Philip for a great presentation, to Ken for providing the space and facilities, to Charlie Farinella for organizing, promoting and moderating the evening, and to all for attending and participating!

State of the Computer Book Market, Part 4 – The Languages – OReilly Radar

Over at O’Reilly, Mike Hendrickson posts State of the Computer Book Market, Part 4 – The Languages – OReilly Radar. Bear in mind in the world of lies, damned lies and statistics, these are statistics. Like measurements of job posting vs. languages, or web pages vs. languages, these aren’t an indication of what languages are in use out there, or what languages are suitable for use. This is just a measurement of what book titles sold the most, grouped roughly by language. If the best book on your favorite language is years old, it’s probably shown as small here. If a bunch of crappy books got published on the language-of-the-week, and the authors and publishers did a good job of getting a buzz going, it’s probably scoring high. Don’t use this to decide whether to use vi or emacs, tabs or spaces.

But it’s interesting data.

Retro-tagging a WordPress blog

I’ve got a WordPress blog with a couple thousand posts, upgraded several times, from a TWiki blog to a Radio Userland blog to WordPress and a couple of upgrades. And I’d like to add the new taggin features available in WordPress 2.3. Here’s what I’ve figured out from poking around: what used to be wp_category is now wp_terms and terms contains both categories and tags. The categories are hierarchical from a self-join using the group column to link back into the term’s term_id primary key. wp_terms in turn links into wp_term_taxonomy: that’s got a column named taxonomy that contains groups like ‘category’ and ‘link_tag’ and a parent column that self links into term_id, which I think is a duplication of what wp_terms is doing. There’s also a count field, meaning that we’re denormalizing the count of categories and tags, meaning if we hack at them, we’ll need to manually update this (see below). Finally, the posts are related to categories and tags using the table wp_term_relationships that’s a many-to-many link from the post’s primary key, object_id, to the term_taxonomy_id primary key of the wp_term_taxonomy table.

So, here’s the recipe to retrofit tags into some posts. I used phpMyAdmin as the web interface into the MySQL table that holds WordPress’ data. You can do the same via the mysql terminal interface or using other remote connectivity like ODBC or your choice of tools.

1. Create or update a tag in the wp_terms table. Note the term_id PK.
2. Insert the term_id and category of ‘post_tag’ into the wp_term_taxonomy table.
3. Create the linking records in wp_term_relationships with the following SQL. In this case, I’m tagging with “Ruby” any post that has “Ruby” in the title or post.

INSERT INTO wp_term_relationships
SELECT wpp.id object_id, `term_taxonomy_id`
FROM wp_posts wpp, `wp_term_taxonomy` wptt
JOIN wp_terms wpt ON wptt.term_id=wpt.term_id
WHERE wpt.name='Ruby'
AND wptt.taxonomy='post_tag'
AND (wpp.post_content LIKE '%Ruby%'
OR wpp.post_title LIKE '%Ruby%' )
ON DUPLICATE KEY UPDATE
wp_term_relationships.term_taxonomy_id=
wp_term_relationships.term_taxonomy_id

(The ON DUPLICATE code is just a quick hack to tell MySQL to ignore it if you’ve already tagged some posts Ruby by hand.)

4. Hack away. When you’re all done, you’ll want to fix the count in the table with the code below:

UPDATE wp_term_taxonomy wptt
SET wptt.count=
(SELECT count(*)
FROM wp_term_relationships wptr
WHERE wptr.term_taxonomy_id = wptt.term_taxonomy_id
GROUP BY term_taxonomy_id)

You say Framework, I say Toolkit, let’s call the whole thing off

Well, it seems that a million monkeys pounding on a million keyboards will write… a million PHP frameworks. I’ve got a client project that needs a rich client front end, likely with DHTML-Javascript-AJAX, a powerful middle tier with complex business logic and processing, and an interface to the backend data that can both support (and hopefully automate and generate) the dozens of generic CRUD processes but also allow overriding with complex SQL (you know, the nasty, multiple page, outer join, union, correlated subquery, inline-function SQL that takes days to write, debug and document, runs in milliseconds, and makes the whole operation worthwhile). Bonus points for caching at the component level, plugin widgets that do all the latest cool stuff (tags, RSS, digg, widgets, etc.) and a smart graphical IDE that can act as a design surface, debugger and data browser. A good manual available online and on paper, along with an active developer community is essential, too. Oh, and Free as in beer along with Free as in speech is desirable (for the former) and required (for the latter).

A guy can dream, can’t he?

There’s a great comparison chart on 10 PHP frameworks from PHPit.net, although dated last year. The many comments indicate that some folks think some of the features aren’t properly credited or misunderstood. Some posters may disagree on the meanings of “MVC” or “ORM.” Some may disagree on what “is” is. Some, I suspect, are those monkeys typing at keyboards. Others likely have valid points. The chart is 14 months old (March 26, 2006) and not getting any younger, while the frameworks either rocket ahead or wallow in the doldrums. I note, for example, the Zend Framework version 1.0 is in Release Candidate phase, just two weeks ago, a major milestone usually taken with some gravity.

There’s not a lot of discussion on how and why these ten frameworks were chosen. Why not blueshoes or dojo? And how about those CMSes? A number of the more powerful Content Management Systems could serve as the basis for an application: already they have a user gui, a writer/editor/moderator/developer UI, connections to a database, and “stuff” in the middle. How well the stuff is designed and whether it’s flexible enough to fit application logic in there brings into place the philosophical questions of where an application begins and where content management ends. I fear that way leads madness: a tool specifically developed for one purpose stretched into a general-purpose tool can be a rough fit. The closer the designers stayed to their original focus of “delivering content” the less likely it is to be flexible enough.

It looks like I’ve got my work cut out for me sorting the wheat from the chaff… any pointers from readers would be welcomed. The good news: it’s all about choice. Having many choices is great news.

MonadLUG notes, 10-May-2007, dd and Seth Cohn, Drupal

Ten attendees made it to the May meeting of the Monadnock Valley Linux User Group, held as usual on the second Thursday of the month at the School Administrative Unit #1 offices, Hancock Road, Peterborough.

Bill Freeman presented his thoughts on the Man Page of the Month: dd. Bill provided two pages of notes. Quite the discussion followed obscure and useful things dd could do, such as preserve floppy drive images for posterity, copy music CDs to images for subsequent loopback mount and playing, copy and restore bootblock records and of course read and write tapes.

Seth Cohn was the featured speaker of the night and spoke on Drupal, the content management system. Seth has screenshots of a surprising number and variety of sites that are running on Drupal, presented a bit of Drupal history – seems it’s been around for a long time, and had a fairly stable history – and its current state, with fairly large and active communities of developers and implementors. He covered a bit of the architecture and philosophy of the modular design of Drupal and did the fairly painless install and initial configuration. 9 PM came too soon as there was lots more to see.

Thanks to Seth for presentation, to Bill for MPoM, to Charlie for organizing the meeting and to all for attending and participating.

WordPress 2.2 released

WordPress 2.2 has been released, and it looks like it’s got some pretty cool features:

On behalf of the entire WordPress team, I’m proud and excited to announce the immediate availability of version 2.2 “Getz” for download. This version includes a number of new features, most notably Widgets integration, and over two hundred bug fixes. It’s named in honor of tenor saxophonist Stan Getz.

It also looks like a big enough change not to be an overwrite-and-see-if-it-works update, but rather a carefully planned backup, parallel, switchover, test, test, test process. Look for the upgrade here in the coming weeks…

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.