Mostly about my amusement

Month: July 2010 (page 1 of 2)

Some imaginary files are alright

This is probably a case of my not reading the manual.

I use W3 Total Cache not because I get a ton of hits. I run it because it’s cool and interesting. With the current 0.9.1 version it suggests that you add to your .htaccess file a section to handle 404 for missing static files. So non-existent txt, css, jpg, etc. will just get the web server’s 404 page and save on CPU processing via WordPress PHP.

Sensible, but robots.txt  is an imaginary file for my WordPress blog.  Requests to that file get sent to index.php and the output is dynamically created. Without the exclusion, that file URL always gets 404’ed.

Easy to fix. Right above the W3TC lines just add these lines to your .htaccess file.

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^robots.txt index.php [L]
</IfModule>

The ReWriteCond is not really needed, I’m just putting it in to be complete. If a request comes in for robots.txt it will be sent to WordPress for handling.

Why would the Chinese do that?

Reading the NY Times Editorial this morning made me shake my head.

China, which has abetted its neighbor’s excesses for too long, needs to ensure that the North’s bluster is only bluster. And it needs to tone down its own.

via Editorial – North Korea’s Latest Tantrum – NYTimes.com.

The North Korean government has successfully turned the carrot and stick idea on its head. Kim Jong-Il has successfully become the James Bond villain and knows that he’ll get more food, more fuel, or just more money.

While the Chinese government may be embarrassed by their neighbor’s behavior, there is not much reason for them to flex their muscle. Stability in the region is important but while it is the U.S. interests that does not translate into the interests of the Chinese government.

I do agree that the Chinese government could get involved differently, I just don’t believe they’ll do so because the west wants them to.

Use WordPress child themes

Before WordPress 3.0 the default Kubrick theme was called, um, “Default”. In the support forums people would update to the latest and greatest WordPress version and become shocked when their edits to the Default theme were lost.

It’s part of the WordPress distribution. When you override the WordPress files, those get included as well. Now with 3.0 the Default theme is gone and replaced with Twenty Ten. People will still make the mistake and modify the theme directly.

It’s not necessary and by creating a few simple file and directories, using a child them on your own is easy.

I’m a fan of the Hybrid theme and have been using a child theme already. The Vigilance theme caught my eye and I thought I’d give it a try. It was even easier when I located their instructions on how to start off.

1. Start with a pristine copy

I downloaded a copy of Vigilance from the Theme Foundry website and extracted it to my wp-content/themes directory. The version on their website is 1.51 which is slightly more up to date than the version on WordPress.ORG’s site.

2. Create your child theme directory

In wp-content/themes I create a directory called mostlyharmless-vigilance and extracted the files from this zip file into it. This is outlined in The Theme Foundry’s instructions.

3. Modify the CSS on the child theme

In the child theme directory I modified the style.css and added  a few lines:

.center-ad { text-align: center; margin:10px 0 10px 0; }
ul li.widget ul li a {
 display: inline;
 padding: 0;
 background: none;
}
embed {
 background: #fff;
 border: 2px solid #eee;
 }
#wrapper {
 background-color: white;
 border: 1px solid #ccc;
 padding: 15px;
 margin: 25px;
 margin-left: auto;
 margin-right: auto;
 border-radius: 10px;
 -webkit-border-radius: 10px;
 -moz-border-radius: 10px;
}
body {
 background-color: #ecf1ef;
}

This was to do provide me a CSS class to

  1. Provide a class to center my 2 ads
  2. Modify how the sidebar links look
  3. Put a border around and embedded videos
  4. Mess with the wrapper ID
  5. And change the color of the body background.

Nothing dramatic and the rounded corners are very 2004.

4. Modify the child theme’s functions.php file

My child theme has one useful line in it like so


php
$GLOBALS['content_width'] = $content_width = 600;
?>

I use oembed to insert YouTube and Vimeo videos into my posts. By adding this line, the embeds become 600px wide when the content supports that.

5. Start modifying files (if you want to)

The Vigilance theme will display that posts featured image if it exists. I comment out that line in index.php to disable the from happening. I copied index.php from wp-content/vigilance into wp-content/mostlyharmless-vigilance and edited line 15

<div class="entry clear">
<?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail( array(250,9999), array( 'class' => 'alignleft' ) ); ?>

and commented out the if function.

<div class="entry clear">
<?php // if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail( array(250,9999), array( 'class' => 'alignleft' ) ); ?>

Next I copied the header.php file into my child directory and modified the second line DOCTYPE from strict to transitional. Some plugins I use look better in transiti0nal.

Last, I made a copyof single.php and modified it to insert my second ad.

6. Upgrades wont worry me now

The whole point of this exercise was to make changes to the Vigilance theme while not touching the Vigilance theme’s files. When an update to the parent theme comes out, I won’t have to worry about what I’ve changed.  The three files I have modified are easily determined and simple for me to support.

If you only want change the CSS, then it’s even less work and you can skip step #5.

SNIPER: Ghost Warrior

I now have a game to replace the sniper FPS that I play the most.

The FPS Sniper Elite is one of my favorite all time PC video games. As a World War II American OSS sniper, you crawl around parts of Germany and execute missions.  These missions need to be performed covertly and mostly in silence. Unless you got them into a long killing field, simple numerical superiority meant that if a squad of Germans or Russians rushed you (the sniper) then you died.

It even had a follow the bullet camera mode for those really good shots, complete with a range indicator.

The game was great but it was obviously designed for an original XBox in 2005. The graphics are dated and the AI is repetitive. I’ve played it so often that I manage to quickly wipe out the enemies and accomplish the mission.

My buddy and fellow Sniper Elite fan recommend that I get SNIPER: Ghost Warrior. A quick visit to steam and the game was purchased and installed in no time.

It’s got everything I like about Sniper Elite but it’s a 2010 game taking place in South America. The graphics, sound, and missions are great fun. When you die you get to replay the mission and target the bad guys that you missed.

Here’s a scenario I just did.  To get to a light house I tried to crawl and make my way to my destination without engaging any enemy troops. After getting shot up and compromising the mission, I realized that troops were paired into 3 groups and I could kill them off without alerting anyone. Once I got to the lighthouse I was able to wrap up the mission.

I’ve only played it for  about 2 hours but I really like the game and should have it wrapped up in a couple of days.

Cue the vacation music

Lily and I started our vacation Friday night by eating at the Bhatti Indian Grill and enjoying really good spicy food. It was also our wedding anniversary and unlike last year neither of us forgot it. 16 years plus 5 years dating! She’s perfect.

We have very different vacation styles.  She likes to fill up each day with activity to maximize the time we have. You know, go places, do things, etc. I used to joke that vacations with her was like a military campaign and sometimes it was. I always had a great time with her but the pace was a little intimidating.

There is nothing wrong with that kind of planning. But I get deadlines and furious activity on a daily basis at work. NOTE: THIS IS NOT A WORK DIG! But when you work in a certain industry you deal with fire drills all the time. It comes with the job and I’m fine with that.

How do I prefer my vacations? I like to just take it easy and relax. Go places (or not), run around (or not), and accomplish thing you set out to do (or not). My goal for this week is to relax with Lily and the kids.

I would like to accomplish the following things.

  1. Spend quality time with the wife and kids. Quality time? Can’t believe I’m using that phrase, but what that means is “Don’t sweat the small things”. You know, take it easy with family.
  2. Start and maybe complete another Bandai MG model. I’ve got the MG Gouf v2 all lined up (Lily won’t let me order more unless I make my unassembled model stash smaller!)
  3. Take more pictures. I like my amateur photo hobby and really am jonesing for a 24-70mm  f/2.8 Nikon lens.
  4. Do something with my WordPress theme! The latest not-really-a-GPL-argument-just-copyright-infringement has gotten me to examine how my blog looks. If only I had the time to learn CSS, that’s what really sets one site apart from another.

The last item on my list is to have fun and relax. The list is incidental as long as I have a good time. Mostly I’ll just cheerfully go with what the family does.

By the way, my vacation theme music? It would have to be this song.

No iPhone 4 for me yet?

Not really news, but nice to see that Consumer Reports can send people the straight scoop.

This seems to put to rest the myth of this being a software glitch. I still plan on getting one. I was going to get the bumper anyways and it’s still an awesome phone despite the antenna flaw.