I finally got around to profiling this site and came up with some astounding conclusions – it takes almost a second to fetch each post on this blog!
Therefore I’ve started to catch blog posts seperately from the main index page. In simple testing I’ve already noticed a significant speed-up but if you notice anything strange please leave a comment here or email me at the usual address!
Category Archives: b2
b2++ Updates
Regular visitors to this site will have noticed that this blog and others on the server take an inordinate amount of time to display sometimes. Basically, this machine is unfortunately under-powered but we’re working on making the best of use of the available hardware with some changes to MySQL and Apache and to b2++ too. Here’s what I did this morning:
- Referers are checked and only if requests go to either “/”, “index.php” or “archive/” are they recorded.
- Referers are now recorded using INSERT DELAYED.
- I added keys on the post_date and post_category fields in *posts tables. The main SELECT is now a “range” instead of “all” request.
Here’s a short bash script you can use to update your db. Remember to change “username” and “password” to suit your own setup.
for i in `echo show tables | mysql -u username -ppassword b2|grep posts`; do echo "ALTER TABLE \`$i\` ADD INDEX ( \`post_category\` )"| mysql -u username -ppassword b2; echo "ALTER TABLE \`$i\` ADD INDEX ( \`post_date\` )"| mysql -u username -ppassword b2; done
Useful links: Mysql Optimization | Optimizing MySQL: Hardware and the Mysqld Variables (mentioned previously) | MySQL Optimisation and a few other pages.
Most Popular Posts
I’ve just added a new plugin to the site that lists the most popular posts on your blog.
The command is {popularposts} which creates an array, $pposts, containing the list of posts. Unfortunately it’ll only work if you use the newer $blogid/archives/p/1/ type url, not the old $blogid/archives/m/200407/#1
Thank you Nargler for the MySQL substring_index code. Helped a lot!
Here’s an example usage:
{popularposts}
{if $pposts != ''}
<b>Most Popular Posts</b><br />
{foreach from=$pposts key=key item=hits}
<nobr><a href="{$siteurl}/archives/p/{$hits.postID}/c/1/more/1" title='{$hits.title}'>{$hits.title|truncate:30:"..."}</a>: {$key}</nobr><br />
{/foreach}
{/if}
Referer Checking Now Ignoring Bots!
I’ve added code to the referer checking to check for a few common bots:
- “http://help.yahoo.com/help/us/ysearch/slurp”
- “http://www.googlebot.com/bot.html”
- “http://www.blogdigger.com/”
- “http://search.msn.com/msnbot.htm”
- “Feedster, LLC.”
- “http://www.breakingblogs.com/timbo_bot.html”
- “fastbuzz.com”
- “http://www.pubsub.com/”
- “http://www.bloglines.com”
- “http://www.drupal.org/”
- “Ask Jeeves/Teoma”
- “ia_archiver”
- “http://minutillo.com/steve/feedonfeeds/”
There are others but these showed up in the access logs of the last few minutes!
Sorry guys, your referer lists will be a lot shorter now!
B2++ 0.8.1 out!
Although it’s a minor update, the latest release of b2++ should be installed by everyone running b2++. I have provided a very simple upgrade package as well with only the changed files so you’ve no excuse not to upgrade!
Check the download page for links!
Changes:
- Referer display of Google and Yahoo queries nicer.
- Cosmetic changes to backend pages.
- Added Photoblog plugin.
b2++ Post Titles in URLs
Here’s another minor b2++ update. I added the blog post titles to permalinks, The title isn’t used to find the actual post, it’s simply there for search engines to find and index.
It should help somewhat in your rankings if you select your post titles carefully!
b2++ Photoblog
What with the proliferation of photoblogs around the Internet I thought we should get in on the act!
Features:
- Displays one image, with optional surrounding html code.
- If no image is available selects a previous image at random.
- Only certain images will be used. No surprises!
What to do:
- Add this code to your blog template:
{photoblog}
- There are optional parameters too:
start: Starting html code.
msg: Title of the picture.
randmsg: Title of a random photo
end: Ending html code.
class: css class inserted into the img tag.
ie.{photoblog start="<div align='center'>" msg="<b>Pic of the Day</b>" end="</div>" class="pictureborder"}
To always display a random photo just passwhen='random'
to the plugin. - Upload images to your blog with the filenames photoblog-YYYYMMDD.jpg
Paginated Posts in b2++
Minor b2++ update here but it’s a good one for those of you with lots of content. b2 always had a “Previous Page/Next Page” function but I never enabled it in b2++. This morning I fixed that so to activate it do the following:
- Go into the Options page and change “Show XX days/posts” to “Show XX posts paged” where XX is some number.
- Add the following code to your blog template:
{$posts_nav_link}
. I’ve put mine instead a blockquote tag but you can do what you like to style the links.
Next up is a Smarty function that takes as parameters a b2 function name and parameters to make it easy to call original b2 functions.
Spammers have been busy!
The spammers were busy last night and this morning! I received some 20 comment spams and notifications are still coming in. So, now when you go into the comment moderation page, when you “delete” comments, they actually are deleted from the database now.
To delete old comment spams simply open up the “Deleted Comments” page and hit “Submit All”.
So, to the spammers.. don’t bother. You’re not going to get through here!
Later.. On suggestions from Pronnsias I modified the Comment Validation page further and put the comments inside textareas, and added links to the New, OK and Delete header fields. Clicking on them will auto-select the associated checkboxes. A Javascript error occurs but it still seems to work, in Mozilla at least.
Later still.. Until the storm of comment spam drops off, notification emails are disabled. Check the Comment Moderation link during the day if you see comment number increase during the day!
b2++ usage?
It looks like iTools 7 for Mac OS X & Mac OS X Server is using or at least shipping b2++ as one of their “new extentsions to make websites easier”. It sits alongside such well-known stalwarts as Gallery and phpBB2 and PHP-Nuke! (Thanks Mark for the link!)