WordPress — Relative Specification of Directory

19 August 2008

Amongst other things, I've been hacking at the theme for this 'blog, fixing bugs and simply tweaking things more to my liking. While I'm at this task, visitors are occasionally going to find the 'blog either cosmetically flawed or just plainly dysfunctional. (And, tragically, they may find it thus after I'm finished.)

In the course of my hacking, I wanted to use the PHP function file_exists() to check amongst files within the theme directory. One possibility would be to hard-code a relative specification of the theme directory (the theme slug appended to wp-content/themes/), but that approach isn't robust; it would increase the ways in which the theme could be broken by external change or by cloning.

While WordPress has a function call to return a specification of the directory, it does so in the form of an HTTP URL, notwithstanding that there is a call that explicitly requests the theme URL, to the same effect; meanwhile, PHP function file_exists() will choke on a URL. I went prowling around the WordPress documentation, and did some code-diving, but didn't find a function call or global variable for anything more like a relative specification of the theme directory.

However, there is a function call for the URL of the 'blog — get_bloginfo('template_directory'). My hack to get the relative specification, which could preface file-specs that could be usefully handled by file_exists(), was

substr(get_bloginfo('template_url'),strlen(get_bloginfo('url')) + 1)
The + 1 is to account for the fact that returns to queries to get_bloginfo() for directory URLs don't have a terminal slash.

Inglorious

16 August 2008

In conversation last night or this morning, the Woman of Interest noted that cannibalistic killers are at elevated risk for brain disease, whence we got onto the subject of kuru.

Many people have heard or read of kuru, a form of prion disease noted amongst a people of Papua New Guinea, as a result of cannibalism, but I noted to her that there are a few twists to the story which which most people are not now unfamiliar.

The south Fore people, who were the people in question, seem to have picked-up the practice of eating the dead from a neighboring people who did so for religious reasons. But the Fore only adopted the practice, not the religion. The women were just having a little nosh as they prepared the bodies, and were sharing with the children.

An acknowledgment that kuru was caused by cannibalism — which acknowledgment later helped scientists and policy-makers to recognize how other prion diseases spread — was impeded because, in the 1970s and '80s, an anthropolgist, William Edward Arens, had with remarkable success made politically correct the denial of culturally based cannibalism. That is to say that the existence of cannibalism wasn't altogether denied, but it was claimed to be always an extraordinary act of deviance or of desperation. (On at least one occasion, Arens took a researcher to task for noting the physical evidence for cannibalism amongst a vanished people, instead of working to promote the virtues of their extinct culture.)

Daniel Carleton Gajdusek, who won a Nobel Prize for his work on identifying the cause of kuru, was in Papua New Guinea largely for the boys. He was a child molestor.

A Man of Many Hats

15 August 2008

*The Village Hat Shop has a price-match policy.

The New LJ Basic Accounts

15 August 2008

On 17 July, LiveJournal, Inc, announced the return of Basic Accounts. As previously noted, what was actually happening was that Basic Accounts were going to be replaced with a new sort of account with the same name.

The essentials of the new programme have now been reported:

  • Journals of Basic Accounts will display advertisements to anyone not logged-in, but will not display them to those who are logged-in.
  • New Basic Accounts cannot be directly creäted, but one can creäte new Plus Accounts, and then downgrade these to Basic accounts. (The official report is somewhat confusing on this matter, because it is inconsistent in its conceptualization of Account.) The objective of blocking direct creätion seems to be to get new subscribers to try a Plus Account before trying (and often before discovering) the Basic Account.
The report does not discuss what happens when Permanent Account journals are viewed with Basic Accounts. In the case of community journals where the subscription is internal (eg: lj_2008), banner ads are shown when individual entries are viewed with Basic Accounts. In other cases, ads are not being displayed by Permanent Account journals viewed with Basic Accounts.

Based on some experiments, the advertising policy for registered external IDs appear to be same as for the new Basic Accounts.

Not Best Practice

14 August 2008
[image of a doubtful balcony]

Hyckleri

13 August 2008

I received an IKEA catalogue in the mails to-day. They shouldn't have bothered, as I will not buy from them.

In 1999, IKEA proposed to the City of New Rochelle, NY, that they use eminent domain to steal the City Park neighborhood, so that IKEA could have the land for a store.

On the cover of the catalogue, it says

Home is the most important place in the world.

I imagine that some of the people in the City Park neighborhood felt that way about their homes.

But I Shan't Talk out of It

11 August 2008

For many years now, I have had a Peterman duster (in the original canvas color, which I'm happy to see has again become available), but really no hat to go with it. I've been known to wear a baseball-style cap (with a graphic for the now-defunct UCSD HP-PAL) with it, but the result was questionable.

While I was out to-day, I was seized by the urge to get a hat. So I stopped at the Village Hat Shop. There I found and purchased a chestnut-colored Jaxon Nubuck Safari.

(As I was completing purchase, the salesgirl said that /ˈkiən/ was a fine Irish name. I didn't tell her that my middle name is in fact pronounced /ˈkʌɪən/ and that, though there are Irishmen named Kian, in my case my name was just an invention based on my father's notions of euphany, and his disregard for how a name pronounced /ˈkʌɪən/ ought best to be spelled.)

The hat unfortunately isn't packable/crushable, but should develop some character with time.

Park Place

11 August 2008

I am compelled to correct a claim that I made about Babycakes. Rather than simply sacrificing their parking in order to expand their patio, they have actually installed a very nice moveable partition; which has at least two possible configurations, one of which provides a larger patio but no parking, the other of which provides parking and less patio space. I believe that they can move the partition in a matter of a few minutes, and yet it looks permanent in either configuration.

I did not get to Babycakes last night until shortly after 21:00, at which time the pool was partially drained and any whipped cream boys were long gone, so I didn't take any photos. However, I was told by a barista and by one of the owners that photos were on-line. I believe that these can be found at their MySpace.

Something in the Oven

9 August 2008

I was skimming a summary of the log for this website, and noticed a few hits from various searches for babycakes. This prompted me to do my own search for babycakes, which revealed one or more baked-goods firms doing business by that name, doing inter-state business, or with a presence in California. That means that if the local Babycakes hasn't licensed the name, then there could be a trade-mark battle.

In any case, Babycakes continues to transform the site. In my opinion, most of the physical changes make the place more appealing. A change largely effected to-day reflects considerable confidence, though it may represent a miscalculation; specifically, they have extended the front patio by eliminating the meager parking. [Correction (2008:08/12): The parking wasn't permanently eliminated. Rather, a reconfigurable partition has been installed, which allows the patio area to be extended or contracted.]

I was told a few days ago that peculiar things will be happening at Babycakes to-morrow. Reference was made to a pool and to whipped cream boys. I may not get there until after such events (I didn't get to the place until almost 22:00 on Saturday), but I'll bring a camera if I think that I have a chance of capturing images.

Telling the Truth Slowly

9 August 2008
Statement of Senator John Edwards By John Reid Edwards

I am and have been willing to take any test necessary to establish the fact that I am not the father of any baby, and I am truly hopeful that a test will be done so this fact can be definitively established.

All right, now:

  • If Edwards is not the father and ended the affair in 2006, then why did he surreptitiously visit Ms Hunter subsequently?
  • If Edwards is not the father, then why did he feel the need to publicly admit to the affair, since his supporters and the mainstream media would have taken a negative paternity test for him (or a positive test for Mr Young) as pulling the rug from under the more general claim of an affair?
I think that Edwards is telling the truth slowly, which is to say that he has planned to admit to the affair and to paternity, but is now deliberately doing so in stages. I don't know how coherently he had previously thought about what he would do, but my guess is that at various times he has told himself that the affair and paternity could be indefinitely concealed, that they could be revealed after his wife dies, or that they could be revealed after he'd achieved greater acclaim in the office of President, of Vice President, or of Attorney General.

Meanwhile, spare a tear for Chet Edwards; his chances of being chosen as running-mate have been gravely injured simply because Obama will understand that there are a fair number of people who would confuse Chet Edwards with the guy who had that affair. (Obama would have been foolish to choose Chet Edwards in any case, but he might have been foolish.)