Blog

Thursday, March 13, 2008
some blogger stuff
I'm messing around with my Blogger template a bit right now, so the blog may look weird until all the pages update. I haven't touched the template for this thing in about two years, I think. The basic layout will remain the same; I'm still plenty happy with the two-column layout I borrowed from BlueRobot some time ago.

Labels:

posted by Andrew 9:58 PM
0 comments

Thursday, September 06, 2007
Post 1000
Well, this should be the thousandth post on my blog. I don't have anything particularly interesting to say about this. Here are a few totally uninteresting things going on in my life right now:

I've been using Blogger for this thing since 2001, and it's always worked well for me, aside from an occasional hiccup. I'm kind of surprised that I've kept it up for so long, but I've never completely lost interest in it. I don't know if anyone else has ever gotten anything out of this blog, but it's helped me out on several occasions. It's useful for me to be able to go back and see what I've been thinking and doing in the past; what I've been reading and listening to; what I've been working on. It helps out a lot when I'm trying to do what David Allen would call a 30,000+ ft review.

Labels:

posted by Andrew 9:22 PM
0 comments

Sunday, September 02, 2007
blog changes
Not that anyone's going to be that interested in this, but I made a couple of changes to the sidebar on this blog today. First, I removed the Technorati and Spurl widgets. I guess I never really figured out what the point of Technorati was, and the little widget I had on the side didn't seem to serve much of a purpose.

Spurl, on the other hand, is a great web-based bookmark manager. Unfortunately, it appears to be a zombie site at this point; it's still up and running, but at reduced functionality, and, looking at their user forums, it doesn't appear that anyone's minding the shop -- there's nothing but link spam in the forums right now. I'm still using Spurl, but I'm thinking about dropping it, since it's probably going to disappear at some point. (I have a mental image of Spurl running on a server in a closet somewhere that everyone's just forgotten about. At some point, the hard drive will die, or someone will find it and unplug it, and that'll be the end of that.)

I've replaced the Spurl widget with a del.icio.us linkroll. I think that's a little more representative of what I'm bookmarking lately.

And I reformatted the tag list. It used to be a bulleted list. Now it's just the keywords separated by slashes. I just wanted to make it more compact, so you could see it all together easily.

Labels:

posted by Andrew 1:26 PM
0 comments

Saturday, November 25, 2006
Blogger label cloud
I just found a PHP script by this guy that does pretty much the same thing that my script does, except in the form of a cloud instead of a list. Nice. He also uses a cache file so he doesn't have to read the directory on every call. Both of those were things that I had thought about adding to my PHP program. Now I can probably just borrow this guy's code.

Labels: ,

posted by Andrew 9:57 PM
1 comments

more fun with Blogger tags and PHP
I wanted to enhance my tag list PHP program to do a couple more things. Basically, I wanted it to be aware of when we are on a label page, so that we could make the list item for the current page plain text (instead of a link), and so that I could put a link back to the main page on any label page.
Normally, I have a link back to the main page in the header of any page other than the main one. I do this through the Blogger template, using the "ItemPage" and "ArchivePage" Blogger template tags to figure out when we're not on the main page. Unfortunately, there's no "LabelPage" template tag, as far as I can tell.
Making one of the list items text rather than a link broke the sorting, since I was just sorting on the text of the list item, including the "a href..." stuff. To get around this, I switched to using an associative array, where the key value is the tag.
Here's the code:
<?php
$dirname = "."; # current directory
$uri = $_SERVER["REQUEST_URI"]; # the page we're on
$bOnLabelPage = false; # are we on a label page?
$dir = opendir($dirname);
$file_list = array();
$i = 0;

while (false != ($file = readdir($dir)))
{
if (ereg(".html$", $file))
{
$tag = substr($file, 0, strlen($file)-5);
$key = strtoupper($tag);
if (ereg("$file$", $uri))
{
$file_list[$key] = "<li>$tag";
$bOnLabelPage = true;
}
else
$file_list[$key] = "<li><a href='/labels/$file'>$tag</a>";
$i++;
}
}
closedir($dir);
#natcasesort($file_list);
ksort($file_list);
?>
<h1>My Tags</h1>
<?php
if ($bOnLabelPage) echo ("<a href='/'>[Back to main page]</a>");
?>
<ul>
<?php foreach ($file_list as $file) echo($file); ?>
</ul>

A little more complex than what I started with, but still not too bad.
As a side note, I am using TextWrangler to edit PHP files on my Mac, and it's working pretty well. It's got syntax-highlighting for PHP and HTML. I'm also now using Fugu to copy files up to my server. It integrates well with TextWrangler, so that I can just keep a file open in TextWrangler and have it copied back to the server every time I save. Nice.
On Windows, I'm mostly using Multi-Edit and WinSCP. That combo works pretty well too, though I'm using an older version of Multi-Edit that doesn't have PHP syntax highlighting.

Labels: ,

posted by Andrew 4:31 PM
0 comments

sorted list of tags
OK, this time I've revised my PHP code to show a sorted list of labels:
<?php
$dirname = "."; # current directory
$dir = opendir($dirname);
$file_list = array();
$i = 0;

while (false != ($file = readdir($dir)))
{
if (ereg(".html$", $file))
{
$tag = substr($file, 0, strlen($file)-5);
$file_list[$i] = "<li><a href='/labels/$file'>$tag</a>";
$i++;
}
}
closedir($dir);
natcasesort($file_list);
?>
<h1>My Tags</h1>
<ul>
<?php foreach ($file_list as $file) echo($file); ?>
</ul>


Not a big deal, but it does show a (probably) typical use of arrays in PHP. As a side note, the "foreach" construct in PHP is a bit different from the usual foreach in other languages. It's usually something like "foreach (item in list)", while in PHP it's reversed: "foreach (list as item)". I should also mention that I first tried the regular sort() function, but switched to natcasesort(), since a case-insensitive sort makes more sense here.

Labels: ,

posted by Andrew 11:50 AM
0 comments

Friday, November 24, 2006
Blogger Tags
Well, I wrote a quick PHP script to create a list of tag links that I could display on this page. It should be over to the left. The code is pretty simple:
<?php
$dirname = "."; # current directory
$dir = opendir($dirname);

while (false != ($file = readdir($dir)))
{
if (ereg(".html$", $file))
{
$tag = substr($file, 0, strlen($file)-5);
$file_list .= "<li><a href='/labels/$file'>$tag</a>";
}
}
closedir($dir);
?>
<h1>My Tags</h1>
<ul>
<?php echo($file_list); ?>
</ul>


I don't have the tags showing in any particular order yet, but they're all there. I just saved this code to a file in the labels directory on my server, then included it in my template with a server-side include.
Also, I should mention that I used this page to format the source code above so it would look OK in a blog post. (Hopefully, it *does* look ok...)

Labels:

posted by Andrew 12:03 PM
0 comments

Wednesday, November 22, 2006
more Blogger weirdness
I think I just discovered that the post archive settings went slightly wrong at some point, either because of the change over to the new beta, or at some point in the past. Either way, I just fixed it by putting an explicit archive URL in the settings. I think. If the archive links don't go where they're supposed to, then maybe not.

Labels:

posted by Andrew 9:39 PM
0 comments

Blogger Beta
I just switched this blog over to the new Blogger beta. I like having labels (aka tags) built into Blogger -- that was overdue. I don't like the fact that the BlogThis! bookmarklet doesn't work anymore. And it looks like I can't put a list of labels on this page for as long as I'm still using the classic template style. I'd have to switch to the new layout scheme.

Labels:

posted by Andrew 8:47 PM
0 comments

Sunday, April 23, 2006
Alternative Style Sheets
My dad has trouble reading this page since I switched to the fancy CSS layout. Apparently, all the fancy positioning and sizing screws things up when you've got your computer set up to use large fonts, a high-contrast color scheme, and so on. I've been meaning to implement an alternate style sheet for him, and I've finally gotten around to it, with the help of this article. If you look over at the link bar, you'll now see buttons to switch between the "normal" style sheet, and a "basic" style sheet, which simply turns off most of the fancy stuff and basically switches back to a one-column design, with the left bar at the bottom of the page instead. The JavaScript code behind the buttons should set a cookie, so the style sheet choice will be persistent. Let me know how it works!

Labels:

posted by Andrew 9:06 PM
0 comments

Wednesday, September 14, 2005
Google Blog Search
A new blog search page from Google.

Labels:

posted by Andrew 7:01 PM
0 comments

Tuesday, June 19, 2001
Aside from adding the blog, I also updated my links page today, and played around with the page formatting a bit.

I recommend you check out Scott McCloud's I Can't Stop Thinking #6. It's a pretty cool take on the whole Napster thing.

Labels:

posted by Andrew 9:18 PM
0 comments

This is the first post in my blog.

Labels:

posted by Andrew 8:17 PM
0 comments


This page is powered by Blogger. Isn't yours?
© 2008 Andrew Huey