gists, php, blog comments edit

I had a problem where I wanted to add a pMCode tag in pMachine to allow me to automatically link to other pages on my site. For example, normally you can use [url=http://somesite.com]linktext[/url] to create links to other sites… but what if you want to link to pages in your own site? Adding hard references like that makes the site sort of inflexible if you change your URL or move to a different server (which is the problem I had). Wouldn’t it be nice if you could link to, say, your comments page by doing something like this: [commentlink=123]linktext[/commentlink]

So that’s what I drummed up. It seems to work for my site, which only hosts one blog, but it should work for multi-blog sites, too. To enable this change, you’ll need to edit your /pm/lib/pmcode.fns.php file.

At the top of the pmcode_decode function, add the following:

global $weblog;

Now add the following lines as shown, around line 305 in the file, with the rest of the substitutions:

// [commentlink=123]sometext[/commentlink]
$str = preg_replace("/\[commentlink=(.*?)\](.*?)\[\/commentlink\]/i", "<a href=\"" . get_comments_link('\\1', $weblog) . "\">\\2</a>", $str);

Then copy and paste the following function in that same file, somewhere toward the bottom:

function get_comments_link($postid, $weblog = ""){
 global $db_multiweblogs, $db_categories, $db_weblog;
 global $db_members, $db_upload_prefs, $db_nonmembers, $pingserver_path;
 global $db_comments, $profileviewpage, $auto_xhtml, $url_rewriting, $sfx;

 if ($weblog == "") $weblog = "weblog";

 $db = new DB();
 $blogid_array = array();
 $sql = "select id,weblog from $db_multiweblogs order by id";
 $query = new DB_query($db, $sql);

 while ($query->db_fetch_object())
 {
  $blogid_array[$query->obj->weblog] = $query->obj->id;
 }

 unset($query);
 unset($sql);

 $catpage = (isset($blogid_array[$blog]))  ? $blogid_array[$blog] : "1";
 $pagespath = get_pref("pages_path_abs_$weblog","1");
 $comments_page = get_pref("comments_page_$weblog");

 $delim = '?id=';

 if ($url_rewriting == 1)
 {
  $delim = '/';
  $comments_page = str_replace($sfx, '', $comments_page);
 }

 $catrow     = 0;

 $comments_url = "$pagespath{$comments_page}$delim$prefix{$postid}_0_{$catpage}_{$catrow}_C";

 if ($url_rewriting == 1) $comments_url .= '/';

 return $comments_url;
}

That should do it. Now you can use the new “commentlink” pMCode tag. Just pass in the ID to the entry you want to link to, like this: [commentlink=123]linktext[/commentlink]

Good luck!

I know enough about myself to admit my weaknesses and know the boundaries on my abilities. For example, I have very little patience with people. I already know I have this flaw, and I do my best to accommodate for it by avoiding situations where it may require I have a lot of patience in regards to socializing with others. I try to spare myself - and everyone else - the pain of having to deal with me once my patience wears out.

See, for me, patience is sort of like a bank account: You have a certain amount of patience, you spend it on different situations, and when you’re out, you’re out - time to back off and build up some more patience in the old account.

Teaching people is like going on a patience spending spree. I get spending long before I even get to the teaching part. I start thinking about all the different stupid shit the person I will eventually be teaching will want to know, then I get thinking about how I’m going to answer the questions - particularly technical questions from a non-technical person - and pretty soon I’m already stressed out and pissed off.

Putting this into perspective, I just got off a very, very long project at work that pretty much kept my patience bank at a low level. I got by, but barely, and I look back on it now as a trial that I successfully overcame; I’m happy with the end product, I’m happy with the team I worked with, and I’m happy that we were able to succeed. That said, I need a little time before jumping right back into the fire so I can build my patience account back up. I’m fresh out. Plus, now that I’m working on a different project, I’d like to actually make some headway on the new project, not continually context-switch back to the old project.

I got word today that we’ve got a non-technical guy who needs to be educated on how to do some reasonably technical stuff to customize the output of my last project. To that end, I’ve been tasked to train this guy on how to do the changes, then potentially have a meeting where I train a room full of these people.

Asking for this is akin to saying “We have a whole bunch of people who don’t know how the web works; in two hours or less, you need to teach them how to make web pages using cascading style sheets.” At the very best, my patience bank just got robbed for whatever was left; more likely, I’m going to end up shooting all these people and then shooting myself.

You might ask yourself what the big deal is. The problem is in the way I work. My mind moves very quickly and not necessarily in a straight line from point A to point B. In fact, there are usually about 20 different points in between that I stop at on the way. This doesn’t translate well in a training environment for things where there’s not actually a process to follow. In many cases, I don’t even know how I got from point A to point B - there was a path, there was some method to the madness, but articulating that is beyond my abilities. This trait became problematic in college math classes where I’d write out the problem then the solution right after; you’re supposed to show your work but I don’t know how I got the answer, I just knew what the answer was.

It’s the articulation of the path that blasts away my patience. If I slow down enough to explain the exact thought process going on, I lose track of where I am and don’t actually accomplish anything. Ever start to say something and then forget what you were going to say right as you were going to say it? It’s like that. I’m like, “Okay, first you do this, then… uh… what were we working on?”

Note that this is different if I have a curriculum to teach and there’s a process to be followed. When it’s not “train this entirely non-technical person on a totally unstructured technical topic,” I do reasonably well. I can answer questions, follow a curriculum, and all is well. It’s when I have to get into defining a process for how to do something at the same time I’m trying to teach the person how to do it that really gets me… the impromptu requests for training on topics that have no curriculum, process, or structure. That’s where we have issues.

Anyway, I’m doing my best to make my displeasure at this training idea known without overtly pissing too many people off. I’m quickly coming upon the time where I won’t care about who I piss off, though, and that could be career limiting. Here’s hoping I don’t end up getting fired, eh?

downloads, media, music comments edit

I’ve seen a few ways to do this out there, usually involving a Perl script of some nature, but why go to the hassle? When iTunes exports the XML, just transform it using an XSL style sheet to convert to HTML. This might not be as easy for the lay user, but it is certainly better than manually scripting it.

First, download itunes2html.xsl and put it in the same folder as the exported library XML file.

That’s it. If you open the document in a browser that knows XML (like IE6), the XML will automatically be displayed after being transformed to HTML. Copy and paste the results into Excel, if you want. Works pretty well. Note that to actually get HTML source out of the thing, you’ll have to use a command line transform utility like MSXSL.

personal, net, sql comments edit

The end of a long, long journey has finally arrived.

I took my last test today, MS070-228: Installing, Configuring, and Administering Microsoft SQL Server 2000 Enterprise Edition, and passed. I got a score of 854 (passing was 700) and from the look of the results sheet, I think I only missed one question (they don’t actually tell you how many you got right or wrong, but you can sort of tell by looking at these little graphs they give you that show your strengths and weaknesses based on the questions you got right).

That makes me a Microsoft Certified Database Administrator, which, alongside my existing Microsoft Certified Solutions Developer for .NET certification, is pretty cool. It’s been over a year in the making, and it’s finally come to fruition.

Yay, me!

I like a good customer service experience. I don’t normally ask for assistance from customer service at a company - I’m a big fan of self-service - but when I do need help, it’s not like I’m making up some imaginary need.

I’m trying to troubleshoot an issue where a user on our intranet gets prompted to log in when they visit the intranet home page. Internet Explorer should automatically log them in, but it’s not doing it. I found that they have some Segue Software products installed, so thought I’d search the knowledge base over there to see if there are any known issues.

First, they make you register to read the knowledge base. Normally I don’t have a problem with this, but they do it in a sneaky way: They show you a form where you enter your email address, desired username, and desired password, then you click a register button… just so you can fill out a second, longer form with more personal information. Fill that out, click the register button again, and you get told that they have to “confirm” your account, so you can’t access the site until you get an email from them with a confirmation link.

That wouldn’t be too bad if the email showed up quickly, but it takes half an hour to get to you. Once you click the registration link, it validates your account, but you still have to log in.

So you log in, go to the knowledge base, and enter your search terms. Clicking search gets you nowhere, though, because you have to select a product name to search articles about that product. Here’s what you see for the list of products: Where's the
beef?

At this point, I’m pretty irate. I decide to contact the support people directly to tell them there’s a problem with their knowledge base and it needs to be rectified:

Hello!

I’m trying to search your knowledge base but it tells me to “select a product from the dropdown box.” Problem is, it doesn’t POPULATE the dropdown box with any product names, so I CAN’T.

Please either fix the selection box or remove the requirement that I select a product.

Thanks, -T

Pretty reasonable request, right? Here’s what I get back:

Hi Travis,

Thank you for contacting us with your request. Please provide your customer ID so that we may open a technical support call for this issue.

Please also include your customer ID in any future correspondence with the support department as it allows us to track your issues more efficiently.

What? You want my customer ID and all that because your site is broken? I don’t want you to open a call, I just want your fucking site to work so I can do my job. I’ve been fighting this thing for a while now, and I’m fresh out of patience.

God forbid you just fix your site and make it usable without opening a tech support call and asking for all the serial numbers. I’m not the end user of the product; the guys in the QA department are. I want to find out if you have any KB articles on effects that your products might have on [insert long technical problem description here]. I don’t have the actual customer ID number or product serial info, I’m just an IT guy trying to troubleshoot a potentially related item.

Thanks for the lack of help, I’ll see if I can get the QA guys to log me in on the site with their accounts or something.

I figured it was over at that point. One of the QA guys logged me in and, wonder of wonders, the product selection box populates, things seem to magically work. But their tech folks aren’t letting up.

When you contact technical support you will always be asked for your customer id number so that we can confirm your entitlement to support whether that be information or more in depth technical help.

With regards to access to information on the support website you should note the following.

In order to log into our site you must first create your own user profile. During the registration process we must validate your entitlement to create that profile. One of the ways we do so is by confirming your customer id number, and that, that number is tied to a customer with valid maintenance.

Further if you are not listed on our customer database as a bona fide contact for that customer id, then you will not be able access any of the secure areas of the support website. (from your correspondence it appears that this is the problem you experienced).

Since when has the knowledge base been a “secure area?” An even better question: How come I can get to the “secure area” but have some broken form so it looks like a technical malfunction in the site as opposed to a conscious decision to deny access? God damn, these people stepped on my last nerve.

I find it fascinating that accessing a knowledge base, granting access to which costs you nothing and would actually probably SAVE you in support costs, is considered support that I might have to qualify to be “entitled” to. You might take a page from Microsoft or IBM, reasonably successful companies, and provide online, self-help style support without qualification. I can see denying access to forums or other interactive support, charging for personal attention from a technician, but the knowledge base? What if I download an evaluation product and want to search the KB? Looks to me like I’d STILL be denied, and I wouldn’t have a customer number to provide you.

Assuming that you don’t provide support without qualification, you might want to either actively disable the knowledge base search form or put something on the site somewhere so it doesn’t just look like you guys messed up when a non-qualified user logs in and tries to search. If I’m not allowed to search the KB, I shouldn’t even be given the option. Instead, I get taunted with a form and end up in a ridiculous email chain like this.

Consider me unimpressed. I have since gotten a QA guy to “loan” me an account so I can actually search the knowledge base, so I suppose the point is moot. I know what recommendation I’ll be making if and when they ask me about what software company to go with, though.

And that’s where it stands. Here’s a message to all those companies out there who require people jump through ridiculous hoops to get self-service support from your web site: You’re turning away potential and, in many cases, existing customers.