Flour Power

a blog by António Farinha


Archive for the Blogging

One Year of Flour Power

That's right! This little corner of the web is already one year old. And so I feel obliged to do some kind of summary.

My mother said I'm obligated to wish you a happy birthday

It's was on the 17th of January 2009 that I inaugurated Flour Power. One year later and it's still here, after 239 posts with 292 comments. The site has seen a total of 83,512 unique visitors that produced 105,092 pageviews. Most of them got here from search engines (76.87%), of which Google was the biggest contributor. Geographically speaking, the 4 biggest sources of traffic were the USA, the UK, Canada and Ireland. But there was also 1 person from Rwanda that considered the blog interesting enough to spend more than 5 minutes here.

And what made all those people come here? The 10 most popular posts of 2009 (excluding the Facebook "incident", which alone caused about 50% of the total traffic) were:

  1. Barney Stinson’s “Get Psyched” Mixes (3,969)
  2. Katy Perry Totally Looks Like Zooey Deschanel (2,454)
  3. Fixing Windows Live Messenger 8100030F Error (2,343)
  4. Make Your Own Pop Art With Warholizer (1,851)
  5. Ryanair Flight Attendant Edita Schindlerova is Pornstar Edita Bente (1,708)
  6. Turn Your Picture Into a “Obama Hope Poster” (1,490)
  7. Listen to Dave Matthews Band New Album For Free (1,475)
  8. Google Chrome is The Safest Browser Around (1,302)
  9. Test Your Movie Skills With Empire magazine’s The Cryptic Canvas – 50 Movies Hidden in a Painting (1,300)
  10. The Cryptic Canvas Answers (1,011)

As far as content is concerned, Flour Power started off as a daily frequently updated diary of my "adventure" of leaving my home country for 6 months to live in Galway, Ireland. As those 6 monhts turned into a year (and now probably two), the frequency of said reports was reduced, and the type of posts changed with it. This is now a place where I post the most fun/interesting/useful stuff I find around the web, along with the occasional rant about whatever is bothering me at the moment. And that's how I plan to keep it going forward.

So if you enjoyed it so far, stick around for a while longer. I'll try not to disappoint :D

  • Facebook
  • Twitter
  • MySpace
  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • FriendFeed
  • email

Wordpress 2.8, Codename “Baker”, Now Available

Wordpress logoWordpress, the blog engine that powers this blog, has released it's version 2.8, codenamed "Baker" (in dedication to the famed jazz musician Chet Baker).

I'm not going into a lot of detail because you can see an explanation of the changes here and here, but the highlights are:

  • New (easier to use) theme install capabilities;
  • Syntax highlighting in the code editor (apparently not working in Google Chrome);
  • Improved Widget user interface and support for using more than one widget of the same type;
  • New screen options in every page to better organize the items on the screen.

Also, Wordpress claims they made a lot of speed improvements and corrected hundreds of bugs.

I've successfully upgraded to the new version via the automatic update (not without making a backup first) and everything seems to be working fine. Let me know if you detect any issues.

Download page

  • Facebook
  • Twitter
  • MySpace
  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • FriendFeed
  • email

Wordpress Hack – Displaying Popular Posts

On my quest to improve this blog, I just added a way of keeping track of how many views each post has, as well as a list of the most viewed (see the footer).

I followed a tip from Pedro (blog in Portuguese) and went for the WP-PostViews plugin. It basically adds a couple of fields in the database and some functions to update each post's view count and display it.

The installation is very easy. It's all explained here, including how to use it. Basically: install (you can use the Wordpress auto installer), activate, and then add a snippet of code wherever you want the info displayed.

<?php if (function_exists('get_most_viewed')): ?>
   <ul>
      <?php get_most_viewed(); ?>
   </ul>
<?php endif; ?>

That's the code to display the most viewed posts. You can also display the least viewed and the count for each individual post.

More plugins can be found from the same guy who did this one, Lester Chen. I might take a look at them in the future, there seems to be some neat stuff there.

  • Facebook
  • Twitter
  • MySpace
  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • FriendFeed
  • email

Wordpress Hack – Float a Specific Set of Posts to the Top of the Main Page

This is the first post of what I expect to become a series about Wordpress hacks, i.e., small tweaks that I'll be doing to customize this blog's Wordpress functionality.

The most observant of readers might have noticed something that can look a bit weird. The order of the posts in the blog's main page is not the same as the order in "Recent Posts" or in the RSS Feed. What's happening is I'm making some posts "sticky", that is, they'll cling to the top of the homepage even if I post something else afterwards, instead of just having all the post showing up in reverse chronological order.

Let me explain the reason for this. The main objective of this blog is to share my personal adventures now that I left my hometown to work abroad. But sometimes I like to post some other random stuff, like the review of a TV show, some cool web application,  a rant about something that's annoying me, or just something funny I found on the Internet. To help keeping the blog on track, I've chosen to always float the latest post from the Personal category (the one where I file all the posts related to my day-to-day happenings) to the top. This way, blog visitors will always see one post from that category at the top of the homepage.

OK, now for the hack itself. The Wordpress main page is basically a loop that goes through all the published posts and displays them:

<?php
if (have_posts()) : ?>
  <?php while (have_posts()) : the_post(); ?>
  // display post and related metadata
<?php endwhile; ?>

So, to achieve the intended functionality, I added some code to display the post I want floated to the top. It's basically the same as the main loop, but I use WP_Query() to retrive the post I want to display. Note that you need to store the id of the post in some variable so that you can skip it in the main loop (or else it would show up twice). Also note that some tweeking has to be done to account for a Wordpress "feature" that makes the tags on the first post to disappear. The resulting code (cropped for simplicity) is:

// sticky post(s)
<?php
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('category_name=Personal&showposts=1');
while ($wp_query->have_posts()) : $wp_query->the_post();
  $do_not_duplicate = $post->ID;?>
  // display post and related metadata
<?php endwhile; ?>

// all the rest
<?php
//query_posts('');
$wp_query = null;
$wp_query = $temp;
if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate) continue; ?>
  // display post and related metadata
<?php endwhile; ?>

You can easily control what you want displayed on top by parametrizing WP_Query() as you like. And the only change will be in the homepage, everything else will be in it's "normal" state.

UPDATE: It seems that this "hack" caused the pagination to stop working. To solve I just had to assign the $temp value we stored in the beginning to the $wp_query variable. The code above has been corrected. Full explanation here.

  • Facebook
  • Twitter
  • MySpace
  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • FriendFeed
  • email