Annual Report from WordPress



Today, I received my annual report from WordPress/Jetpack.  I have always enjoyed these reports, so I thought I would make it public.

For the complete report, view it here: Linux Sagas 2013 Year in Blogging

(more…)

Posted in Blogging. No Comments »

Cache Tuning for Inodes

I have been struggling with my website’s backups running.  Host Gator requires the Inode count to be under a certain level in order for the backups to run.  The best part about it is that they have added tools to the CPanel to show the usage and backup status.

After fixing the problem, here’s what my backup status panel looks like:

Backup Status Panel

Also, farther on down the left hand column, Host Gator offers an Inode measurement.  Again, after fixing, here’s what mine looks like:

Inode Status Indicator

Last time, I messed with the git repositories to clean up some of the inode usage.  This time, I looked into the WordPress Caching.  I am using a cache plugin called W3 Total Cache.  Because it was not configured correctly, it was using up more inodes than it should have.

So, it was time to check on performance again, and I wanted to do a before and after performance measurement.

(more…)

Posted in Blogging. No Comments »

Too Many Inodes

I recently switched to Host Gator, and they have policy about the number of inodes.  I just noticed that my account moved to “Not Backed Up” just recently.  So, I thought I would blog a few of the things I learned while exploring…

Determining the Number of Inodes in a Directory

I found this command would do the trick:

find . -printf "%i\n" | sort -u | wc -l

One of the advantages of Host Gator is that they provide SSH access.  I was able to login quickly and run the command in the different directories.  If you have a host that doesn’t offer SSH access, may I suggest PHP Shell?

Git Repositories

I had a rough guess that my git repositories might be part of the culprit.  If it’s based on the number of files, I guessed that git uses a bunch to track changes.  So, I did a little tinkering.

Sure enough, most of the inodes in my project are in the .git directory:


$ find . -printf "%i\n" | sort -u | wc -l
2050
$ find .git -printf "%i\n" | sort -u | wc -l
1195

I found a few options to try.  First, I tried the fsck command, but that didn’t seem to make a difference in the inodes:


$ git fsck --full
Checking object directories: 100% (256/256), done.
dangling commit 9e18c6e42e3f62127776bdd2f52608f904991e08
$ find .git -printf "%i\n" | sort -u | wc -l
1195

Next, I tried the gc command, and that seemed to make all the difference in the world:

# git gc --prune=today --aggressive
Counting objects: 912, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (900/900), done.
Writing objects: 100% (912/912), done.
Total 912 (delta 525), reused 0 (delta 0)
$ find .git -printf "%i\n" | sort -u | wc -l
37

The repack didn’t do much:

# git repack
Nothing new to pack.
$ find .git -printf "%i\n" | sort -u | wc -l
37

WordPress Cache

My next culprit is the WordPress Cache.  For example, on one of my blogs, the cache accounts for 76% of the inode count.


$ find . -printf "%i\n" | sort -u | wc -l
23323
$ find wp-content/cache/ -printf "%i\n" | sort -u | wc -l
17766

Well, that is another task for another day.  This is where I will start though.  If you have any ideas, please comment.

Resources

Posted in Blogging, git. No Comments »

Downtime Explained

Just a quick website update: I just switched hosts this past week.  If you noticed any downtime, please accept my apologies.  If you see anything still not working, please let me know.  I think I have it all back up.

If you are interested in the details, you can read about it here: Digital Eagle Blog: Switching Hosts Again!

Posted in Blogging. No Comments »

Website Move Complete

Just a quick post to let you know the website move is complete.  I’m sorry about any down time you may have experienced.  Hopefully, I can get active again and start blogging again.

If you are interested in the details check out:

Posted in Blogging. No Comments »

Blog Moving Again

Ok, It is time to move the blog again!  But, this time you shouldn’t have to change your bookmarks!  I am just moving the website to new web host.

The transfer is supposed to be seamless, but I suspect you might see a little downtime over the next week as the domain re-registers and points to the new site.  If it’s not working, please give me some time and check back.

I’ll update you on the other side!

Posted in Blogging. No Comments »

Great Link: WordPress Plugins

via http://www.flickr.com/photos/pimkie_fotos/2451289441/sizes/o/in/photostream/

via Flickr

I am always open to more lists of WordPress Plugins:

Lunarpages Blog: Ten WordPress Plugins Worth Considering

The one I picked up from this list was WP Super Cache.  My blog definitely needs a speed boost.

The next one I probably need to come back to is the Mobile Press.  The only problem is that the link was broken.  I’ll have to come back and research that later.

So, let me add a few of my own:

Ad Injection: Previously, I had tried to implement the ads manually into my theme.  I found that they were slowing the site down.  This plugin makes implementing ads correctly easier, and it gives you more options as well.

Edit Flow: While it is just me blogging, I still use this plugin to try to organize my posts.  I have created a “Stub” status that I use when I find a topic that I want to write about.  Then, I created a “Needs Research” status to indicate that I still have work to do before finishing the article.  I also created a “Pending Review” status to remind myself to review the article one more time before publishing.

Jetpack: If you don’t already have this installed, WordPress should start to bug you about it.  For me, it just means better looking stats.  I need to delve into setting up some of the other features in it.

Yet Another Related Post Plugin: I need to spend more time on theming the related section, but this plugin seems to make the “related” section at the bottom pretty easy.

Posted in Blogging, Wordpress. No Comments »

Adding the Google +1 to Garland Theme in WordPress

Today, I came across a suggestion on Google AdSense to add the Google +1 Widget to my posts on my website.  Here’s what the notification looked like:

If you want a short description on what the +1 button does, you can watch this short video from the +1 Website:

So, here’s how I made it work in my theme (I am using Garland Revisited). First, I added the javascript link at the bottom of my header.php file.  Here’s the code I added:

<!-- begin Google +1 button -->
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
<!-- end Google +1 button -->

So, here’s what the bottom of my header.php looks like (wp-content/themes/garland-revisited/header.php):

</ul>
</div> <!-- /header -->
<?php get_sidebar(); ?>
<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
<!-- begin Google Adsense -->
....(Adsense code removed)
<!-- end Google Adsense -->
<!-- begin Google +1 button -->
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
<!-- end Google +1 button -->
<!-- begin content -->
<div class="node">

Next, I added the button to the home page. This is the line of code that i added to index.php:

<div style='float:right'><g:plusone href="<?php echo get_permalink() ?>"></g:plusone></div>

Update: I added the href=”<?php echo get_permalink() ?>” code for the index.php.  Without that, the user would be indicating a plus one for the home page rather than the article that the button is next to.

So, here’s what the top of my index.php looks like (wp-content/themes/garland-revisited/index.php):

<?php get_header(); ?>
<?php is_tag(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?>>
<div style='float:right'><g:plusone></g:plusone></div>
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<span class="submitted"><?php the_time(get_option('date_format')) ?> &#8212; <?php the_author() ?> <?php edit_post_link(__('Edit'), ' | ', ''); ?></span>
<div class="content">
<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) {
	the_post_thumbnail(array( 75,75 ), array( 'class' => 'alignleft' ));
}
?>

Now, that only affects the home page. If you go into one of the posts, you won’t see the button. To fix that, we need to add it to single.php. And, here’s what the top of my single.php looks like (wp-content/themes/garland-revisited/single.php):

<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?>>
<div style='float:right'><g:plusone></g:plusone></div>
<h2><?php the_title(); ?></h2>
<span class="submitted"><?php the_time(get_option('date_format')) ?> &#8212; <?php the_author() ?> <?php edit_post_link(__('Edit'), ' | ', ''); ?></span>
<div class="content">

Resources

Posted in Blogging, Wordpress. No Comments »

Source Code in WordPress

Since this is a technical blog, I like to post source code in various forms from time to time.  But, WordPress.com hasn’t been very easy in that regard.

WordPress.com was rather limited — the only thing I found was the [- sourcecode -] tag.  You can read more on that here.

Now that I am on my own site, I am looking to try to improve source code handling with a plugin.

Of cource, the Source Code post mentions that they use the SyntaxHighlighter plugin for WordPress.com. I found another list of plugins, but that just led me back to a different link to the same SyntaxHighlighter.  It does mention a Visual Code Editor that might be interesting.  Apparently, it will work in conjunction with the SyntaxHighlighter. Now, this list looks much more promising: 12 WordPress Plugins to Display and Highlight Code within your Blog

I did a little more looking into the WordPress version (SyntaxHighlighter Plus).  Here is a list of syntaxes supported.  At the bottom, there is some information about how to create your own syntaxes.

This Developer Formatter plugin looks very promising.  The problem is it didn’t work for me.  It seemed to break the editor.

I ran across this thread that talks about adding Code Mirror to the TinyMCE editor.  If I ever get time, I’ll have to try my hand at writing a plugin.

 

Posted in Blogging. No Comments »

Sitemaps

I have been working with Google’s Webmaster Tools, and one of the things that it requires is a sitemap. It took me some tweaking to get it right, but here is what I learned.

First, I had to hand craft a sitemap php file for the main, parent site. The first thing that I struggled with was how to get the content type and XML heading in a php file. The solution was the header() command and to use the echo command.

Here is the heading of my sitemap page:

<?php
header("Content-Type: text/xml"); 

echo '<' . '?' . 'xml version="1.0" encoding="UTF-8" ' . '?' . '>' 
?>

The next hurdle was to determine how to include the last modified field. I found the filemtime() command could read the last time the file was changed. Then, the date() command using the DATE_W3C format puts it in the correct format that the sitemap expects.

Here is what an entry looks like.

  <url>
    <loc>http://digitaleagle.net</loc>
    <lastmod><? echo date (DATE_W3C, filemtime('index.html')) ?></lastmod>
    <priority>0.4</priority>
    <changefreq>monthly</changefreq>
  </url>

Finally, I found a plugin that would generate the sitemap for the WordPress blogs. The plugin is called: “Google XML Sitemaps”:

This plugin adds a new settings page where you can configure different options regarding the sitemap:

I didn’t need to mess with any of the settings. I should have blogged this as I was doing it, but if I remember right, I had to visit this page the first time to generate the sitemap. From there, it takes over.

At the top of the settings, you can see stats such as when it last generated the XML. You can also force it to rebuild the sitemap.

Resources

Posted in Blogging, PHP. No Comments »