Categories
Just Shelley

In France Now

I drove over to see my Dad in the hospital yesterday. When I entered the room he looked at me without recognition for a moment, before going “Michelle? What are you doing over here?”

Though the trip is four hours each way, that’s not outside of reason for visiting one’s father. I said, “I though I would drive over and see how you’re doing, Dad.”

“You can’t drive to France”, he answered.

My Dad can become disoriented in the hospital, or whenever he’s very stressed. When this happens he reverts back to two significant events in his life: the first was when he was in the 82nd Airborne during WWII, and he was in France; the second was when he worked for the CIA in Vietnam. Obviously it was going to be a French moment in the hospital during this trip.

He was still receiving units of whole blood when I was there, which surprised me so long after the operation. When I held his hand, I noticed how white it was, and how he had no strength in the grip. Later a nurse came with a shot of insulin as his blood sugar levels were off, and that seemed to help him focus. And he got his favorite meal yesterday – meatloaf and mashed potatoes and gravy. Especially the mashed potatoes and gravy. My Dad loves mashed potatoes and gravy.

Two young ladies from Dad’s assisted living home came out that afternoon to say hi and bring a get well card signed by Dad’s dinner table companions. Dad didn’t recognize them at first, but they were pretty young things and it brought out the Irish charm and blue-eyed twinkle. When he said things that confused them, I quietly mentioned that Dad becomes disoriented in hospitals, but not to worry overmuch.

While they were there, the hospital dietician came up to see what Dad liked for his meals. He mentioned mashed potatoes and gravy. I mentioned applesauce, and Dad’s eyes lit up – he also loves applesauce. And oatmeal and orange juice, and the dietician mentioned he would have a nice breakfast the next morning to look forward to.

I had lunch with my brother as we talked about the decisions that need to be made. The options are that Dad could go into a nursing home for the next month or so to begin recuperation, or return to his apartment, but we’d have to hire special help. Medicare would cover the one but not the other. Dad’s savings are rapidly disappearing but even with the special care he’ll need, he has enough for at least a year and we decided we’d give him a good year. At his apartment, he’ll recover more quickly surrounded by the familiar. And he’ll be happier.

Back at the hospital, I noticed with approval that they had put surgery socks on Dad, and that he was receiving type A blood, donated by a voluteer – thank you whoever you are. Dad’s chart was marked with the letters of “DNR” or Do Not Resuscitate, which means if his heart failed or he stopped breathing the hospital was not to use extraordinary means to revive him. This is a long standing item we have had on request, and the hospital knows this, as does the paramedics who have been out to my brother’s house, and even know where the secret key is stashed so they could let themselves in.

Dad is the one who said to me a few years back that he’d lived too long, and you can see it in his body, as he slowly dies by inches. But he just won’t let go of that spark of life.

Categories
Diversity

In support of O’Reilly

For all the times I’ve been critical of O’Reilly about the lack of women participants at the company’s events, I now find myself needing to speak up in support of the organization generally and Tim O’Reilly specifically.

At Misbehaving, Liz Lawley noticed that the number of female participants at FooCamp was only 10% of the total. However, I know that O’Reilly has been working, specifically, to include more women in these events. And this includes FooCamp.

I was invited this year, but, unfortunately, like others, had to decline because I did not have the money to make it to the event in California. Was I a token invitation? No. I believe that O’Reilly invited me to the camp this year because of my work with, my participation in discussions of, and my writing about technology the last several years–not solely because I’ve been critical of the lack of female participation at these events.

I know I would have been very comfortable talking technology with the group that was there, because I have done so with a large number of the participants here within the weblogs. I would have been a peer among peers at this event.

In a way, I feel as if I’ve let other geek women down by not going; by not bringing more of a female presence to this event. If I had the cash to spare, believe me I would have gone. This is just the type of event I would enjoy.

Perhaps O’Reilly will have me do more writing for the company so that I can afford to attend the camp next year.

Categories
Just Shelley

Stubborn old farts run in my family

Recovered from the Wayback Machine.

My Dad is a remarkably stubborn old fart. His surgery yesterday was I guess rather harrowing for all involved, but as my brother said, my Dad came out looking better than the surgical team who had to fight to keep Dad alive. Dad always did like to make trouble for the doctors.

Mike said he doesn’t look bad today all things considered. He now has a one foot long metal rod in his leg to provide stability. It’s a good thing he can’t fly anyway, because wouldn’t he set off the alarms now. Frankly, though, if he were questioned for being a possible terrorist, I think he’d be rather flattered about the whole thing. At his age and all.

He’s still in intensive care until tomorrow, as I guess the danger time for surgeries, especially for older people, is 1 1/2 to 2 days.

My roommate will be home today, and I’m heading over tomorrow to see Dad, have lunch with my brother.

I sometimes forget, sitting in the isolation of my room or out on my solitary hikes, that I have connections with people: family and friends. Tenuous threads that have a habit of getting caught up on life now and again, providing a good, swift yank as you march blithely along.

Categories
Weblogging

WP to MT: Template engine or function call

When exploring the differences between the dynamic version of Movable Type and WordPress, it’s easy to get caught up in the one using a template engine and tags and the other using function calls. Those who support tags will say, and rightfully, that actual PHP code in a template can be intimidating to non-techs; but those who support function calls say, and rightfully, that template engines add an extra layer of processing to the application.

A template engine parses the template and generates an intermediate page that replaces tags with actual function calls. The reasoning behind doing this is to separate the presentation from the processing, in this case separate the PHP processing from the (X)HTML. Movable Type uses one of the more well known engines, the Smarty template engine, to handle the tag parsing in its new dynamic architecture.

However, a criticism of Smarty is that it doesn’t separate the processing enough, and can add it’s own level of complexity, as demonstrated in this small example from the Smarty site:

<html>
<head>
<title>User Info</title>
</head>
<body>

User Information:

Name: {$name|capitalize}<br>
Addr: {$address|escape}<br>
Date: {$smarty.now|date_format:”%Y-%m-%d”}<br>

</body>
</html>

But then, all template tag systems have some level of complexity if they’re going to be any use. At least for experienced MT users, they don’t have to learn another set of tags: Six Apart’s developers have extended the Smarty class to ‘translate’ so to speak, between MT’s tags, and Smarty’s. All combined, when you put something like this in a MT template such as Main Index:

<MTEntries lastn=”10″>
<div class=”sidecomments”><a href=”<$MTEntryPermalink$>”><$MTEntryTitle$></a></div>
</MTEntries>

After transformational magic, you get:

<?php $this->_tag_stack[] = array(’MTEntries’, array(’lastn’ => ‘10′)); smarty_block_MTEntries($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat=true);while ($_block_repeat) { ob_start(); ?>
<div class=”sidecomments”><a href=”<?php echo smarty_function_MTEntryPermalink(array(), $this);?>
“><?php echo smarty_function_MTEntryTitle(array(), $this);?>
</a></div>
<?php $this->_block_content = ob_get_contents(); ob_end_clean(); echo smarty_block_MTEntries($this->_tag_stack[count($this->_tag_stack)-1][1], $this->_block_content, $this, $_block_repeat=false); } array_pop($this->_tag_stack); ?>

Looks like templates engines make the code a whole lot simpler. But then, look at what you use with WordPress to get the same result:

<?php get_archives(’postbypost’, 10,’other’, ‘<div class=”sidecomments”>’, ‘</div>’, 0) ?>

One of the challenges with a template engine is that you have to account for variations in what people want. This usually means having to build template starting and ending blocks, modifiers, and so on so you can get somewhat complex template tag use. However, with straight function use, you just pass all of this user defined options in as parameters.

As you can see, straight function calls can be simple, and template tags can be simple: it’s how each are integrated into the page that makes the difference. What I think is more important isn’t which approach is used, but how clean the end result is, and how extensible is the underlying architecture. And in these, both Movable Type and WordPress excel, especially with some of the new design considerations with WordPress 1.3. and the intermediate step taken to handle template tag differences between MT and Smarty in the new MT 3.1.

(Weird naming synchronocity, eh?)

(I’ll cover other ‘clean’ tools when I get into porting the Movable Type weblogs.)

As for extensibility, both Movable Type and WordPress are known for their plugin environments, though there has been some criticism of MT’s new PHP plugin environment–existing Perl plugins don’t work with it. However, with Six Apart’s use of the ezSQL database library in addition to Smarty, WordPress plugin authors may now have a new venue for their efforts.

For instance, I have a plugin in WordPress that provides the recent trackbacks, pingbacks, and comments, in one list in my sidebar. I also provide the URL for those who comment, which is why I don’t use the packaged comment functions.

WordPress uses ezSQL for database access, a simplified database API. So does MT for its PHP plugins. Because of the similarity, I could take much of my existing WP plugin and just port it over to MT. The code for the plugin I ported to MT can be downloaded here.

Key code differences, aside from the database structures that set the MT plugin apart from the one in WordPress is the function name, how the database connection is accessed, and the generated text output. Smarty requires that all objects have file names that reflect their nature, such as ‘function.’ for functions, and ‘modifier.’ for modifiers, and so on. The next part of the name is the actual tag element name that’s used in the template, using MT naming conventions, starting with “MT_”. The tag in this case is MTCustomComments. Since the plugin is a function, the file is called “function.MTCustomComments.php”, and the function is named smarty_function_MTCustomComments, the ’smarty’ also being a requirement for the function name within the template system.

Two parameters are passed, ‘$args’ representing any arguments passed to the function, and a reference to the Smarty context, ‘&$ctx’. Looking in the code, you can see how the database connection, db, is accessed through the Movable Type object (that buffer between Smarty and MT), that’s part of the Smarty Context:

$lines = $ctx->mt->db->get_results($sql);

One other difference is that rather than print out the result directly in the function, as I do in WP, I return a string, which is then output automatically within the template. I could do the same with the WP plugin if I was seeking to minimize differences between the environments.

To install the MT plugin, I created a sub-directory called ‘plugin’ in the PHP directory, loaded the new function file into it, and it’s ready to use. In the Main Index page, I then invoke the plugin as follows:

<$MTCustomComments$>

Any PHP function, Smarty Plugin, and even WordPress plugin could be adapted quite easily to the new Six Apart dynamic environment. And this also means that a Six Apart plugin could be easily adapted for use in WordPress. In fact, it wouldn’t take much to create tool-specific wrappers to wrap around functions so they can operate in both environments.

Not just MT and WordPress: let’s not forget other PHP systems with plugin environments, too.

The possibilities are intriguing.

Categories
Stuff

Mixed up world

Don’t you just love the days when I post like I do today? Lots of posts, first technology than politics than tech than politics? What I need is something gentle and reflective, to sweeten what is a relatively bold and saucy collection of writings.

I haven’t been out this week on walks or taking photographs, but did get some film back from the lab with previous trips to the Botanical Gardens. Though I know you’re all deadly tired of reflective pools and such, there are a couple of images from the group that provide a different viewpoint than previous submissions.

I’m also thinking of following Molly’s example with my own Request for Marriage Proposal (RFMP). But I want somebody rich. And old. Who will help me keep Burningbird going in the manner to which we’ve become accustomed.

What say you lonely older guys? Grow ever older with me…the best is yet to be. I may not be young and nubile, but at least I don’t wear rhinestones. I won’t make you clean your feet when we come in from a walk, but you’re on your own when it comes to cleaning the footprints. And I’ll never say to you, “Why don’t you…”

“One must never enter into the relation of marriage. Husband and wife promise to love one another for eternity. This is all fine, but it does not mean very much. . . . Such being the case with marriage, it is not surprising that the attempt should be made in so many ways to bolster it up with moral supports. . . . When two beings fall in love with one another and begin to suspect that they were made for each other, it is time to have the courage to break it off; for by going on they have everything to lose and nothing to gain.”

Kierkegaard

… I believe a kiss comes nearer the idea when a man kisses a girl than when a girl kisses a man. When in the course of years there has come about an indifference in this relation, then the kiss has lost its significance. This is true about the domestic kiss of marriage with which married people, apparently in lieu of a napkin, dab each other’s lips as the man mutters the ceremonial thanks, “That was swell, Mother.”

Kierkegaard

“If it is ridiculous to kiss an ugly girl, it also is ridiculous to kiss a pretty one, and the notion that doing a thing one way is any justification for laughing at a person who does it another way is nothing more than superciliousness and a complot, which does not, however, avail to set such a snob outside the category of the ridiculous, which is determined by the consideration that nobody can say what it means to kiss, although it is assumed to mean that the lovers desire to belong to one another for all eternity, yea, what is still more amusing, it is supposed to give them assurance of this.”

Kierkegaard