Category Archives: Site related

Of / pertaining to p4p.com

Navigating a Web Traffic Jam

If you’ve tried to view ericvb.com recently, you may have been met with various error messages at various times instead of my actual website. Terms like “ACCOUNT SUSPENDED” or “500 Server error” and “Error establishing a database connection” have been appearing all too often.

Turns out I have a couple of blog posts that have become fairly popular, and I thought it’d be interesting to share the story of how my site has had to go from “just a hobby” to something a little more enterprise grade.

Houston, we have a problem
I received an email from my hosting provider stating my account had been suspended due to resource abuse. I then tried to navigate to my site, and I only see “This account has been suspended” instead of my site content. A few emails back and forth with support, and they re-enabled my account to give me a chance to try mitigate the performance issues. I updated plugins and themes to latest versions, enabled some caching and security plugins, and finally even signed up for CloudFlare which has a really nice free content delivery service (more on this later).

Things smoothed out for awhile, but soon my resource usage began to climb again. CPU and RAM utilization were just crushing the server; and since I was on a shared server configuration, my site was making other people’s stuff perform poorly. I had reviewed analytics data and found basically 2 of my posts were the culprits. One on setting up tabbed ssh for Windows, and another on getting started with the ELK stack for syslogging. I tried unpublishing those posts for awhile but I still ended up getting suspended 3 separate times. Finally, I had make the decision to move my website to a dedicated server.

The migration to a dedicated server was really pretty easy. Even fun! MySQL is a great database and was easy to backup/restore, and the rest was just copying files. In the end, my website is better secured thanks to the iThemes security plugin, as well CloudFlare’s front end capabilities.

I really can’t say enough about how happy I am with CloudFlare. It provides caching, content optimization, and security features. Their free offering is very capable, and obviously the paid subscriptions give you more features.

Overall, this entire experience has been a great learning opportunity. Topics I’ve never even thought about such as content delivery, web caching, and WordPess security are now a focus of mine with this website, and hopefully it results in a better experience for anyone who visits…

SOPA / PIPA Blackout

I’m not the “activist” type…

But following the ongoing SOPA and PIPA proposed legislation has me inspired to do my part.

Many strong internet companies are against these bills, and many of them are taking action up to and including blacking out their website for a day.

This is a viral protest, and many sites are taking part in this campaign. Certainly, ericvb.com and its 50 visits per day are merely a drop in an olympic size swimming pool – but we are all swimming in that pool.

Therefore, tomorrow I will be using this handy WordPress plugin to black out my site as well and stand at arms with Wikipedia, reddit, etc.

Learn more about these bills and the blackout by visiting this site:
http://sopablackout.org/learnmore/

PHP Site Tweaks

Recently I’ve made a couple of subtle tweaks to my theme to fix minor issues that have bugged me for some time.

1: The Completion of Twitter De-integration
First on my list was to button up the exclusion of my Twitter category.  For some time, I’ve been using the Twitter Tools plugin to create weekly digest posts of all my Twitter activity.  I appreciate this functionality quite a lot.  I like being able to search a subject and find my WordPress blog entries AND tweets on the subject.  However, I didn’t like spamming readers via RSS or pushing down the real content of my site with what I’d consider “archival” content.  Ultimately I wanted to exclude the Twitter category from every possible area except if you actually click on the Twitter header link to get to that category.

Using a couple custom tweaks to my theme’s functions.php file, I was able to mostly implement this back in 2010.  The Twitter category primarily only shows up if you go the category page.  But, recently I also happened to notice that the single posts have links to the previous post and next post; and unfortunately this loop didn’t read the standard WordPress query.  The previous/next post links embrace their own functions completely.  As such, these were showing the posts from my Twitter category.  🙁

With a little research on the functions specific to post navigation, I found it was pretty easy to ditch the Twitter category here as well.

Original code for the previous/next links:
<?php previous_post_link( '%link', '<span>'
. _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title' ); ?>

Updated code for the previous/next links to exclude my Twitter category:
<?php previous_post_link( '%link', '<span>'
. _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title', FALSE, '28'  ); ?>

The FALSE indicates that the next/previous don’t have to be from the same category, and then the ’28’ is the last variable which is “excluded_categories”.

So, the Twitter category now will really only show up if you’re searching or if you’re clicking on the Twitter link in the header nav bar.  I love WordPress.

2: Double Sentence Spacing
Next up is the effect of my typing style that I cannot break.  When I’m done typing a sentence, I hit the spacebar twice.  This is certainly a debated point as to whether single or double sentence spacing is correct – especially on the internet.  It creates “rivers” of white space at times that can be a distraction, and can be a waste of page space and characters in database tables.  Even worse, my theme would display a quirky structure at times by moving that 2nd space onto the leading edge of a new line, hence starting the new line one space indented from the rest of my site.  It looked terrible.

Example of bad spacing, note the clear indent on the 2nd line:
Note the clear space indenting the 2nd line

In my opinion, it’s better to single space.  I just can’t seem to do it.  I can’t manage to break that habit.  So, I scoured the internet for ways to make WordPress do it for me.  It didn’t take long for me to find a simple and easy function to handle this.

function remove_spaces($the_content) {
return preg_replace( '/[\p{Z}\s]{2,}/u', ' ', $the_content );
}
add_filter('the_content', 'remove_spaces');

I added that code to my theme’s custom function.php file (the same place where I exclude the Twitter category), and all is well!  Wordpress adjusts my double spaced content into single space and displays it beautifully:

I love WordPress

The Death of Google Reader

A few weeks ago, Google announced some big changes to Google Reader.

The overall strategy by Google to unify its services drew them to the conclusion that they have to force all Google Reader users to begin using Google+ to fulfill the social aspect of Reader.  Friending, following others, and commenting on shared items within Reader would now be discontinued…

I don’t think this really hit me until it actually happened.

As I was greeted with the “Welcome to the new Reader” message last week, I finally got a feel for how big this change truly was.  Usually, my first click is to “People you follow” when I log into Google Reader.  Well, that’s now gone.  There’s no longer a simple way to see shared items, to comment on them, or to get a quick overview of what items my friends are reading.  Instead, I’m stuck muddling through Google+ posts trying to find a way to make this social world work again.

I just feel completely lost in the new Reader.  The extra clicks/page views necessary to get the same functionality in Google+ make it difficult and inefficient.  I don’t like the look of the new Reader.  I don’t like having to go back and forth between 2 different sites to see and comment on shared items.  It’s just a sad state of affairs.  I’m sick of companies trying to force customers/users into a model that they obviously don’t support.

As of yet, there isn’t a very solid alternative to Google Reader.  I’ve researched and tested a few, but the social aspect is a key that is missing in nearly every contender.  I’m looking forward to trying out hivemined, which seems to be getting alot of e-buzz as a true Google Reader alternative.  Until then, I’m struggling to adapt to a new way of doing this.  A significant portion of my friends and my own internet activity was spent inside Google Reader, and at this point we’re all trying to re-group as the table cloth was pulled out from under us.

Site Overhaul

I have taken it upon myself to make some dramatic changes to EricVB.com.

Unordered list of changes:

  • Uninstalled Gallery photo publishing software (I never update it, photos go on FB etc)
  • Uninstalled all unused plugins
  • Cleaned out the mysql database. (dropped ~60 tables of g2_*, and also ALOT of tables created by past plugins. If you’re a wordpress dev, don’t ever have your plugin create tables. Store an entry in the options table GOSH.
  • Upgraded lean/cleaned WordPress to 3.2 Beta 1
  • Upgraded immediately to 3.2 Beta 2 which was just released (svn sw ftw)
  • Decide on the new default theme called “twentyeleven”
  • Learn about creating a child theme; which is way more awesome than directly editing theme files – which, I’ve always done in the past.
  • Used my child theme to re-add sidebars to single posts and pages, put in Google analytics code, make various css tweaks

Overall, I like the look of the twentyeleven theme. But there are a couple things that I really do not understand. First:I dont really understand why they remove the sidebar on pages and on single-post permalinks – so it took me some work to figure out how to get that back in there and make it look normal (set pages to use the sidebar template; customized css for all .singular content entries).

Secondly: I cannot stand the header image size. The header in the WordPress 3.0 default theme “twentyten” was 940 x 188. This was too large for my taste, but I rolled with it and grew to be OK with it vs re-writing css to skinny it down. Now, in the 3.2 default theme of twnetyeleven, the header even larger. 1000 x 288. Seriously. TWO HUNDRED AND EIGHTY EIGHT pixels tall. That is nearly a third of your screen resolution before you can even see any content. It’s literally nothing but ridiculous. Therefore, I have disabled the header image completely. If any person responsible for the header image size in the theme “twentyeleven”: I hope your car dies on you tomorrow in gridlock traffic seriously.

Things are certainly still a work in progress… but I am having fun re-tooling my web presence.

The Best Possible RickRoll Method

The phenomenon known as “RickRolling” is certainly nothing new. Millions have been duped into watching Rick Astley’s “Never Gonna Give You Up”. And many, like myself, have had it done multiple times.

Some strategies to Rickrolling a would be victim might include

  • Non-specific Youtube link
  • Use of URL shorteners like Bit.ly or Goo.gl
  • URL re-direction

I’d like to take the URL re-direction bullet, make it a bit overly technical, and unleash what I am convinced is an undetectable rick roll method. Prerequisites include an apache web server with mod rewrite (probably do-able with IIS as well, but I am unaware of rewriting URLs in IIS).

  • Create a folder in the root of your web directory. Name the folder something like “index.html”.
  • Inside that folder, create a file named .htaccess (note the leading dot. Required in the name)
  • Put the following text inside that .htaccess file:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) "http://www.youtube.com/watch?v=oHg5SJYRHA0" [R=301,L]

  • Now, you can link somebody to http://www.yoursite.com/index.html and they will immediately be forwarded to Rick Astley.

I went ahead and implimented this for display purposes here: http://www.ericvb.com/yeah.html