Blog Tag: Web Site
Fusebox File Exists
I hacked my local copies of the fusebox core files (for version 4 and version 5) to NOT check if a file exists before including it. This seems to have sped things up a bit.
I think the file_exists() check is somewhat helpful for programmers during development. When you go live, either the file is there or it isn't. No reason to sacrifice performance for the sake of hand-holding.
I hear you ask, "Why are you using fusebox if you're concerned about performance!" - well... that's a topic for another time... for now, it's not terribly slow.
Popular Posts Follow-up
After posting about Popular Posts, I must have been hit by some spider, or people are actually clicking the "unpopular posts" links in the sidebar (or in that entry). Yesterday I noticed that I only had 3 "unpopular posts" in that list. The problem was I was assuming an "unpopular post" would have been viewed less than 50 times. Silly me. I tweaked the query to always grab the 8 lowest items (in addition to all the other criteria) by removing the views < 50 clause.
Now my "unpopularity" is back up to an acceptable level.
Popular Posts
A while back I added entry counts to the blog entries (damn, has it been that long?). When an entry is visited directly at it's own url, I crank up the count by 1. The visit to the entry has to be on this site, not via RSS. I don't add to the count when an entry is viewed in the main page or in monthly archives; only at it's own link. I thought that would be the most significant way of counting. It would count people going directly to specific entries from Google or linking directly to entries from other sites (one can hope...)
There is no catch for "unique visits" or "visits in a session" - I didn't want to think about it that much. I'm not selling ads with this metric or doing anything important with it. I just wanted to see which entries people are looking at.
With this information I have made 2 new queries, one for popular posts and one for unpopular posts, and I'm displaying the results in the side bar. Check out the popular ones and see what all the fuss is about. Check out the unpopular ones and give them some love, too ;-)
The popular posts simply grabs from the top of the stack and shows the 8 entries with the most views. The unpopular posts is a little different. It grabs from the bottom, but the views have to be greater than 0 and the published_at date has to be less than now (since I implemented post dated entries, those would have the least views). Also, I make offset by the number on the home page to skip all the recent stuff. I really want to highlight old stuff that people may have missed
I should really work up a way to display the middle 8 or so "mediocre" entries. Anyway - at the time I write this, here are the popular and unpopular posts:
Popular Posts
- Michal Training for LLS Ride (2271)
- Comment Spam Measures (1734)
- Trackback Test Entry (635)
- Implemented Trackback (625)
- Making Wrong Code Look Wrong (576)
- Seinfeld's Apartment (401)
- Outbound Link Warnings with YUL (399)
- Mentioned On Gen-X Design (372)
Unpopular Posts
- Wimpy SUV Drivers (32)
- Happy Birthday, Madelynn! (33)
- I'll Be Twenty Nine Soon! (33)
- Application Scope for PHP (34)
- Go Bleep Yourself (35)
- Japanese Pop Culture Is Weird (36)
- Good Ad Placement (37)
- New Mash-Up (41)
Actually now that I think about it, I could do one of those "popular posts this week" entries - with a cron job even. Is that cheating? :-)
Steadier Posting with Software
I mentioned back in January that one of the things I wanted to do to Improve this Blog was to post more regularly. I've noticed that I actually post in spurts. When I sit down to blog one thing I usually end up posting 2 or 3 entires. I do a blog-dump of what's been on my mind lately - one topic per entry.
To make things seem more regular - since I'm not (leave your one-liners in the comments... they practically write themselves) - I've added a "published_at" column to my database table, updated all the queries to check for published_at instead of created_at (if you find SQL errors around her lately, this is why), and edited my "add/edit entry" form to have a field for setting this value.
Of particular interest - and now we're off nerdism a little bit - I have the default published_at value for new entries set it self to: 'some time in the morning on the day after the most recent day I've published something'. For example, as I edit this particular entry, the published_at value is set for the morning of April 13th. I'll never tell when I actually wrote it! Mua-ha-ha-ha-ha-ha!
The upshot is: If I post entries in spurts, they will still come one a day. Maybe if I get enough future entries, I could change the logic to twice-a-day. It's a thought. Anyway - hopefully I'll stay ahead of the current day and there will always be something fresh around here.
Of course, if I really must post something today, then I can just change the published_at field when I make an entry. Blog software programmers, feel free to steal this idea, as it's probably not new.
SQL Foo
I was having a problem on this blog. I wanted to get the recent entries, a count of their comments, and a list of their tags. The query went something like this (this is just a sample; the real one is basically the same, but grabs more columns):
select entry_id, title, count(comment_id) as comments, group_concat(tag) as tags from entries e left join comments c on e.entry_id = c.content_id left join entries_tags et on e.entry_id = et.entry_id left join tags t on et.tag_id = t.tag_id group by e.entry_id order by e.created_at desc limit 0,2
This worked almost perfectly, except I started noticing that entries with more than one comment and more than one tag had incorrect results. Here's an example from a recent entry:
entry_id: 256
title: Royalty
comments: 20
tags: royalty,comments,royalty,comments,37s,royalty,blog,comments,37s,blog,37s,blog,37s,blog,37s,royalty,blog,comments,royalty,comments
Hmm... That doesn't look right.
select count(*) from comments where content_id = 256; +----------+ | count(*) | +----------+ | 5 | +----------+
select count(*) from entries_tags where entry_id = 256; +----------+ | count(*) | +----------+ | 4 | +----------+
OK, Five comments and four tags. "royalty,comments,37s,blog" to be exact. What's going on here? Well, the 20 comments in our result set above gives us a clue. The comments and tags are being multiplied. Duh! OK, I figured that out in like 2 seconds. But how do I fix it? I want it to say 5 comments, and only list the 4 related tags.
Enter the DISTINCT key word. I didn't know you could do this until tonight when I stumbled across it almost by accident - scouring the docs for the answer to a similar, but unrelated problem. The query now becomes:
select entry_id, title, count(distinct comment_id) as comments, group_concat(distinct tag) as tags from entries e left join comments c on e.entry_id = c.content_id left join entries_tags et on e.entry_id = et.entry_id left join tags t on et.tag_id = t.tag_id group by e.entry_id order by e.created_at desc limit 0,2
Note the placement of the distinct keywords. The result is more like what we want! Hooray!
entry_id: 256
title: Royalty
comments: 5
tags: blog,37s,royalty,comments
Hopefully, this helps other SQL noobs like me! Now if I could just get that other query to work right, we might have something...
Gravatar is Back
1 Comment | Latest by: Phil | Add A Comment! »»
Apparently, Gravatar is back, and all new and updated. I'm going to try to implement it into this site again...
If you don't have a gravatar, and you want a cute picture of yourself to show up next to your comments, go sign up with them.
Shaping Up
As I have mentioned in the little right-hand side bar, things are starting to shape up around here. I have my blog/content/comments admin just about tweaked to into having all the features I want. Here's a screenshot of what I see when I'm editing something.
Tonight I added something I've been wanting to add for a long time: a form to edit comments. Don't worry, I'm not going to edit the content of people's comments; I mostly wanted a form for when people forgot the http:// on their links.
I might get into adding a WYSWIG to the admin, although I like being able to control the HTML. Any suggestions for a good editor? Doesn't have to be "cross platform" necessarily; just has to work in Firefox.
When I get another hour or two alone with my web site, I want to bring back categories, but in the form of "tags". Then make my entries automagically have Technorati stuff built in.
After that I'm going to add in Trackback support; incoming and outgoing. Gotta read those specs!
One day, in the distant future, MetaWeblog support. Even if it is by Dave Winer, it seems to be the standard. I could edit with a desktop app or any number of other tools.
Web Designer Blindness
4 Comments | Latest by: Philip Chalmers | Add A Comment! »»
I'm going slowly bind and I blame web designers. Practically every web site I visit, I have to crank up the font. I'm quick with the CTRL+Plus hot key combo. I might actually use Key Config to change it to a simpler combination.
Hey everyone, take two big steps back from your desk, and try to read your own web site. If you can't read it, give us a few points increase, would ya? Thanks... Come to think of it, I can barely read the text on Podo. I'll have to increase it. Then again, I hardly ever read Podo :-)
Update: "I did it, yeah?" I changed my key config to be PLUS (actually EQUAL) for increased size, MINUS for decreased size, and 0 for default size.
Fun with PNG
1 Comment | Latest by: Nancy | Add A Comment! »»
I'm trying out something weird with the header. I've styled the two divs as follows:
#header {
background:url(/img/cam.jpg) no-repeat top right;
}
#headerimg {
background:url(/wp-content/themes/cbl/images/personalheader.png) no-repeat top left;
}
The /wp-content/themes/cbl/images/personalheader.png is a PNG 24 image with transparency, with a hole in it on the right side. The header is using my web cam image as a background. The header gets it's background first (my ugly mug from the cam), then the headerimage, since it's inside of header, displays it's background on top of header's background, creating the nicely wrapped image.
I realize I just lost a ton of browsers with PNG due to the limited support. Someone know the fancy CSS I can use to filter the PNG just to the right browsers? If I can do that I'll serve up personalheader.jpg to everyone else.
Migrating to WordPress
1 Comment | Latest by: Nancy | Add A Comment! »»
I'm migrating to WordPress. :-) It's in a language I can hack as needed.
Changing Again Soon
3 Comments | Latest by: Phil | Add A Comment! »»
I'm going to mess with the web site again soon. This isn't it, exactly. I like the places I've gone content-wise; although I still feel very restricted and unable to talk on my blog. However, I want to go *back* to a few things podo had before, like the random photos, which people loved apparently, the clean layout, which worked better on dad's PDA, the fusebox functionality, which makes me happy as a nerd. Oh, and I want to play with fusebox and ajax. I'm not past that hurdle yet. And I need to re-post and rewrite my early fusebox articles. And write a few more. People liked those. As for the code, Movabletype is great but when it doesn't work I don't know how to fix it. At the very least, if I'm going to use someone else's code, I should use WordPress so I can hack it. Duh.
Also, I'm thinking about this whole blogging thing. Feedburner can slurp in items from del.icio.us and Flickr and slap them in my feed. This makes me think about making my "blog" here a client of the feed, and not the other way around. Although, it would have to go both ways, since I do post the occasional entry around here. Just some thoughts...
Points, Shoots, Leaves
3 Comments | Latest by: nancy | Add A Comment! »»
I started a vlog: Points, Shoots, Leaves. I created a silly entry tonight to kick things off, Toothpaste vs Orange Juice. Subscribe to the feed. Updates to follow infrequently.RSS House Keeping
If you're subscribed to any of my feeds, can you please change your subscription to the Feedburner address? I'm no longer going to support the other feed URLs (and I even deleted the XML files! Ha!). The feedburner address is in my auto-discovery or here: Cultivate Battle Learn. Thanks.
Update: I put in redirects for the old urls, so your agregator might have gone crazy on you saying I had 45 new items (Bloglines did it to me too! I feel your pain!). Sorry about that. Nothing is new, except this update...
Phone to Flickr to Blog
I'm testing out the connection from phone to flickr to blog. I'm blogging a photo from flickr which I sent to flickr from my cell phone. It's a photo of me smiling while sitting at my desk at work. I'm waiting for Tortoise to export a ton of files from a new repository I created. This is as good a time killer as any. Hey! It's done! Later!Contact Form Was Broken
2 Comments | Latest by: Phil | Add A Comment! »»
Thanks to whoever contacted me today. My form was broken and only passed on the coment but no name or email. Was it you? :-)
New Site
1 Comment | Latest by: Pat Harrington | Add A Comment! »»
Hello! I'm changing things again.
Go Bleep Yourself
There is now a way to get a "Go (Bleep) Yourself" response on philsown.org.
It has to do w/ form mail scripts and the POST method. Spammers look for sites that have an insecure version of a popular old "form to email" script and exploit it to send spam. I've noticed a few attempts to find a script like this in my traffic reports lately so I thought I would mess with them (and knock it out of my Failure Report at the same time).
Here's the relevant circuit code:
<if condition="$_SERVER['REQUEST_METHOD']=='GET'"> ... <false> <do action="contactV.phoneyGFY" contentvariable="layout['content']" /> </false> </if>
It says "This is the web version of Nelson going: 'Ha ha!'" Is it Christian of me to cuss at spammers? Probably not, but someone has to. I may generalize the text a little and reuse message in other places too. That might be fun. Enjoy!
Update: This isn't really relavant anymore...

