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

Share
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!

Share
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:

Share
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!

Share
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.

Share
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


Share
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.

 

Share
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

Share
Posted in Blogging, PHP. No Comments »

Ahh! Spam, Your Killing Me!

After moving my blog, one of the problems is SPAM.  And, it seems like it is getting worse.  I get all kinds of spam comments, some advertising various things like iPhones and worse, but the most annoying are these unreadable ones.  These are like random letters or like someone just slid their hand across the keyboard.

Akismet

On WordPress.com, they offer Akismet as a spam filter.  It seemed to do a decent job, and now that I see what happens without it, I realize that I took it for granted.  What I didn’t realize was that it was a service.  The plugin came preinstalled on my new website, but to activate it, I had to sign up for an account on the Akismet site.

I have been reluctant to sign up because I am not sure that I want yet another service.  The cost would probably be minimal if not free, but my profits are minimal if not none.

GASP

A little search for an Akismet alternative turned up iBlogZone’s article about GASP.  GASP stands for Growmap Anti Spambot, and you can read more about it on the WordPress Plugin Site.

I like this option because it isn’t a service.  From what I can tell, it adds a few features to the form that will trick spambots.  First, it looks like it adds a checkbox via Javascript.  Because spambots don’t care about running Javascript, they will not be able to check the box and therefore not be able to comment.  Also, it adds a hidden field that a human would not be able to populate.  The spambot will not realize it is hidden, and that is a dead giveaway.

So, we’ll see how this option goes.

Solve Media

Another option that looked very interesting was Solve Media.  This idea is pretty cool.  They take a problem and end up making money off of it!

I read about it at iBlogZone’s article.  The idea is that you put a Captcha on your comment form.  In order to comment, you have to type the letters from the image, and they are designed so that a spambot could not decipher them.  The cool part about this implementation is that they incorporate an advertisement into it so that you earn money at the same time.

I think I am going to hold off on this option for now.  It is another service after all, and I don’t have enough legitimate comments at this point.

Share
Posted in Blogging, Wordpress. No Comments »

Setting up Google Custom Search

The other day, I was trying to create a Custom Search for all of my blogs.  I had trouble getting it to work.  It wouldn’t save my URLs and therefore wouldn’t return any results.

I finally found a thread showing that you leave the protocol (http://) off when you enter the URLs.  So, my settings look like this:

URLs on Google Custom Search

One of the things that I don’t like about the search is that I don’t seem to have control over the ads on the page.  I don’t like the big section of ads before you see the search results.  That seems like it would be slightly annoying side for the users, but that’s just my thought.

Example Search Results Page from My Site

Still, it seems like it works well though.  All in all, I am happy with it so far.

Please comment any thoughts you have.

Resources

Share

Switch to our mobile site