Categories
Technology Weblogging

Recent Comments Trackback – Introduction

Recovered from the Wayback Machine.

My weblogs show a Recent Comment/Trackback list that I’ve implemented using SQL and PHP rather than MT tags. The main reason I didn’t use tags is that I filter comments to showing only those that are on posts 30 days old or newer. This helps focus comments on current conversations, and also helps cut down some of the comment spamming problems.

An additional requirement for my Last Comments/Trackbacks list to intermix the comments and trackbacks into one list, showing the most recent items regardless of type of comment — local or remote. There are plug-ins to use to do some of this, but I like to keep my fingers into the PHP/SQL world.

To manage this, what I did was use what is called a SQL union. A SQL union operates pretty much as it sounds: it creates one set of data that’s the union of the result of two separate queries, and this data is what’s returned to the PHP program for processing. Unions have been around in Oracle and Sybase and other databases for some time now, but only added to MySQL in version 4.x. Luckily most of us are using 4.x.

The query string I’m using in my PHP process is:

 

$sql = ‘( SELECT tbping_id, tbping_source_url, tbping_title, entry_title, entry_id, blog_archive_url, tbping_created_on, 1 \’flag\’, category_label FROM mt_entry, mt_tbping, mt_trackback, mt_blog, mt_placement, mt_category WHERE entry_id = trackback_entry_id AND trackback_id = tbping_tb_id and entry_blog_id = blog_id AND entry_status = 2 AND placement_entry_id = entry_id and placement_is_primary = 1 and category_id = placement_category_id ORDER BY tbping_created_on DESC LIMIT 20 ) UNION ( SELECT comment_id, comment_url, comment_author, entry_title, entry_id, blog_archive_url, comment_created_on, 2, category_label FROM mt_comment, mt_entry, mt_blog, mt_placement, mt_category WHERE entry_id = comment_entry_id AND entry_blog_id = blog_id AND entry_status = 2 AND placement_entry_id = entry_id and placement_is_primary = 1 and category_id = placement_category_id and TO_DAYS(NOW()) – TO_DAYS(entry_created_on) <= 30 ORDER BY comment_created_on DESC LIMIT 20 ) ORDER BY 7 DESC LIMIT 20 ‘;

 

As you can see, this query is not necessarily for the faint at heart, or someone who isn’t familiar with SQL. I could at this point just tell you to copy and past this into your own page. However, if you’re like me, you don’t necessarily like using technology without having a better understanding of exactly what it is you’re doing, and why.

In this multi-part roll-out of the MySQL/SQL for Poets weblog, I’m going to cover all the different components of this query, including providing a basic introduction to the SELECT statement, using functions with queries, and ending with the UNION and how this query is used within PHP to provide the recent comments/trackbacks list.

Categories
Writing

Borrowing a Page from Wood s as Thanks

I found a page that lists several literary magazines and publications and over the last month or so have been skipping about among the entries, checking out each publication. One such is the The Diarist’s Journal, a revival of a publication that ended a few years back. According to the description, the publication contains Fake, Fictional, and Fictionalized Diaries. I was, of course, compelled to read more, and spent some time among sample entries based around September 11, 2001. For instance, the following, written by “A 33-year-old Journalist in San Francisco”:

9/11, 11pm
The WTC is just gone. People I know, they saw it collapse. Saw it collapse into itself and rain metal and glass and desperate bodies. What’s the point of talking about retaliation? Who do you hit back at? How do you fight a non-corporeal entity? And what good can it possibly do? It’s gone. A terrorist attack with George W. Bumfuck Bush at the wheel. Gods help us….

9/12
I slept until almost 11 today, not wanting to wake up to the changed world. I’m afraid of what might happen. People are attacking Arab-Americans, sending hate mail to mosques. Shrub is talking about a battle between good and evil, an American jihad. People are talking war, not criminal investigation. Who do you hit?…

9/13
…I don’t know what scares me more: the possibility of further attacks, or the possibility that our leaders will destroy our freedoms in order to save them.

The world has changed forever. I know that’s obvious. What’s really disturbing is that the change began some time ago and no one seems to have noticed….

longwall.jpg

Several of the publications only print their Table of Contents online, which is a bit of a tease. But considering that most operate more on hope than on solid funding, it’s not surprising that they don’t want to give “the goods” away for free. But I still prefer the publications that at least provide some of the material online.

That’s why I love The Missouri Review, with so much wonderful reading freely available. Most people turn immediately to the fiction and poetry, but I rather fancy the editorials, in particular those by Scott Kaukonen. Learn that name, you’ll hear it more in the future:

When I first decided I wanted to be a writer, I feared that I would enter the field with a handful of disadvantages, given my what-I-perceived-to-be generic upbringing. I’d been raised in the Baptist parsonage of a small Midwestern town and enjoyed a pleasant childhood. I did well in school, stayed out of trouble, participated in all manner of socially-approved activities, and loved my parents, who in turn loved me. You could say I lacked personal traumas, at least those personal traumas that could be most obviously turned into the material of potboiler fiction. Non-descript seemed the best description.

But when as a young adult I began to travel ‘to see other parts of the country and the world’ the generic seemed less generic. The town in which I’d been raised, the circumstances under which I’d grown, the world as I saw it suddenly appeared different. I’m not exactly sure how that has translated into my stories except to say that I no longer assume that a story set in some faraway land is necessarily more worthwhile to read than a story set in a town that remarkably resembles my own.

rocktree2.jpg

Then there’s my favorite repository of American poetry, The Academy of American Poets. I found two new poems that I liked, both by very well known poets. The first, by Henry Wadsworth Longfellow is The Day is Done:

The day is done, and the darkness
Falls from the wings of Night,
As a feather is wafted downward
From an eagle in his flight.

I see the lights of the village
Gleam through the rain and the mist,
And a feeling of sadness comes o’er me,
That my soul cannot resist:

A feeling of sadness and longing,
That is not akin to pain,
And resembles sorrow only
As the mist resembles the rain.

Come, read to me some poem,
Some simple and heartfelt lay,
That shall soothe this restless feeling,
And banish the thoughts of day.

Not from the grand old masters,
Not from the bards sublime,
Whose distant footsteps echo
Through the corridors of Time.

For, like strains of martial music,
Their mighty thoughts suggest
Life’s endless toil and endeavor;
And to-night I long for rest.

Read from some humbler poet,
Whose songs gushed from his heart,
As showers from the clouds of summer,
Or tears from the eyelids start;

Who, through long days of labor,
And nights devoid of ease,
Still heard in his soul the music
Of wonderful melodies.

Such songs have power to quiet
The restless pulse of care,
And come like the benediction
That follows after prayer.

Then read from the treasured volume
The poem of thy choice,
And lend to the rhyme of the poet
The beauty of thy voice.

And the night shall be filled with music
And the cares that infest the day,
Shall fold their tents, like the Arabs,
And as silently steal away.

morerocks.jpg

Another poem I liked, very much, is Walt Whitman’s “Spirit that Form’d this Scene”, about the connection between artist and the natural world, no matter how separated from the world the art is:

Spirit that form’d this scene,
These tumbled rock-piles grim and red,
These reckless heaven-ambitious peaks,
These gorges, turbulent-clear streams, this naked freshness,

These formless wild arrays, for reasons of their own,
I know thee, savage spirit–we have communed together,
Mine too such wild arrays, for reasons of their own;
Was’t charged against my chants they had forgotten art?
To fuse within themselves its rules precise and delicatesse?
The lyrist’s measur’d beat, the wrought-out temple’s
grace–column and polish’d arch forgot?
But thou that revelest here–spirit that form’d this scene,
They have remember’d thee.

Yes, more pictures of rocks. I cannot go for another walk until my foot is feeling better so I am forced to dig into my photo repository for photos not yet published. Are you tired of trees and shrubs, and ponds, and rocks? Well hopefully soon, I’ll have something new for you.

Speaking of trees and rocks, Rolling Stone Magazine has a wonderful article called Crimes Against Nature, about the destruction of environmental laws in this country. But, like so many other writers, the author of the article also brought in the comparison of times between now and Europe of 1930’s:

Corporate capitalists do not want free markets, they want dependable profits, and their surest route is to crush competition by controlling government. The rise of fascism across Europe in the 1930s offers many informative lessons on how corporate power can undermine a democracy. In Spain, Germany and Italy, industrialists allied themselves with right-wing leaders who used the provocation of terrorist attacks, continual wars, and invocations of patriotism and homeland security to tame the press, muzzle criticism by opponents and turn government over to corporate control. Those governments tapped industrial executives to run ministries and poured government money into corporate coffers with lucrative contracts to prosecute wars and build infrastructure. They encouraged friendly corporations to swallow media outlets, and they enriched the wealthiest classes, privatized the commons and pared down constitutional rights, creating short-term prosperity through pollution-based profits and constant wars. Benito Mussolini’s inside view of this process led him to complain that “fascism should really be called ‘corporatism.’ ”

I was wrong to push back so strongly about the comparison of modern times and the facism of the 1930’s. However, I am still wary of it because I wonder – if today the US is the Germany of the 1930’s, what does that make us? We who live in the country that other people look at with so much distaste? Will the people from the rest of the world some day make us stand in our virtual village greens over the bodies of dead Iraqi and face what we have allowed our leaders to do?

How will you feel about us if we do not manage to remove Bush next year?

rockbar.jpg

Finally, from Mark Morford at SF Gate, Be Thankful you are not Dubya, a list that only Mark can write, and one reason he is still my favorite:

Be thankful that you do not have to suffer Dubya’s massive crushing karmic burden, as wrought by inflicting heaps of environmental disaster and vicious unnecessary war and a stunning string of lies lies lies like a firehose of giblet gravy splattered all over the planet.

Offer immense gratitude that despite a massive ongoing Herculean effort on the part of numerous world governments to rape and pillage and pretty much slap down most all tender offerings of the planet, Earth still manages to produce for us an astonishing array of flora and fauna and oxygen and edible delicacies and awe-inspiring trees and relentless merciless beauty.

We are deeply flawed. We are massively arrogant. We are bratty and insolent and abusive and sloppy and violent. But we balance it with astounding acts of love and beauty and art, nature preserves and activism and organic awareness and sex positivism and community awareness and quiet personal spiritual questing and lots and lots of great bookstores.

Here is where you make you own list. Here is where you set aside the cynicism and the sighing and the bitterness, just for a moment, and get quiet, look around, look inside, check the karmic inventory and offer up heaping pies of gratefulness for what you find.

Amen, Mark. Amen.

(And thanks to another Mark for bringing us so much, including a unique and wonderful style of journal from which I borrowed liberally from for today.)

despair.jpg

Categories
Just Shelley

Men on Harleys

If I seem cranky in my recent posts, I am a bit but that’s just because in the last few days I have had some discomfort in my teeth/jaw/sinus, as well as my foot. These are two areas of the body most sensitive to pain, and I’m hit with both at the same time.

However, I now have legal drugs. Good legal drugs. Nice legal drugs.

I’m also a bit disappointed about a couple of things, including the fact that it doesn’t look like my minimum reserve on my mineral collection auction will be met. I have a starting bid, but not enough to justify selling the collection. My roommate suggests that the timing was bad – Christmas is coming up. Too true. If it doesn’t sell this week, I’ll try again in January.

Also, the Practical RDF book isn’t quite selling as well as other books I’ve written. I’m not surprised – it is a very esoteric subject, and I don’t go to conferences and put my face into other people’s faces, or talk about RDF a lot. It should be a consistent seller over time, especially if I keep updating outdated sample code and putting said code out at the O’Reilly site. But it’s not going to be the success Unix Power Tools is (which was just published in Japanese – I’ll post a photo of the copy being sent to me when I get it), or Developing ASP Components. (which made it into Russian and Spanish).

However, with the sour always comes the sweet. It doesn’t look like my foot is broken, but some toes most likely are and haven’t healed well (heeled well, heh), and the X-Rays tomorrow won’t cost me a dime with my medical (I do have very good medical insurance).

In addition, I’ve had the loveliest comments from the rock and mineral Interest community about the collection. They loved the collection, the stories, the photos. Makes me feel good about the job I did putting this site online.

A couple of other things might be looking up nicely soon, but I won’t say anything specific until the rubber hits the road, so to speak. I also have a very good friend (who happens to have an exceptionally handsome voice by the way), who suggested that my next bits of photography focus on things I don’t normally take photos of, or don’t like taking photos of, to increase my expertise and reach.

Excellent advice, except that I like taking pictures of everything, being a most indiscriminate photographer. However, I am shy about taking photos of people, and that’s one I need to work on. Also, I haven’t spent much time recently taking photos within cities or towns, or of industrial areas, and these could use more attention. In fact, there is a road trip I want to take (when I can afford it again) that will involve taking pictures of people and places of this nature, not just the wonderful Missouri country side.

But I will never tire of taking photos of Missouri. I may mention the statistics about St. Louis and the crime, but this really is a wonderful city full of charm and character. And the countryside – if you’ve never been here, nothing I can photograph, or tell you, will ever convey the richness of this state: the forests, wetlands, granite mountains, and deep rivers. And the charming towns, and quirky, maddening, fascinating, and complex people that live here.

And, girlfriends, the men on Harleys here are drop dead gorgeous. When they say life begins at 50, they must have been talking about these guys, silver foxes everyone, I tell you. Youngsters got nothing on these guys. Well, okay, maybe Johnny Depp and Hugh Jackman, but that’s it.

Did I happen to mention the good drugs?