July 19, 2009

Add a Border to Videos in Blogger Posts

I recently made two upgrades to my blog, both of which took me a few hours to get to work right. The first change was to add an RSS Subscribe button at the bottom of each post. My second change was to add a border around the videos I post, in an effort to keep consistency with the borders around photos. In this second post I am going to show you how to add a border around videos, assuming you use a Blogger template.

The first thing you need to do is sign in to Blogger and then click the "Layout" button. Displaying the raw HTML code is the same process as in the last post for the RSS button.

Once you've done that, click the "Edit HTML" button and then click the check-box for "Expand Widget Templates".

Look for the lines with the following text in your website code:
.post img {
padding:4px;
border:1px solid $bordercolor;
}
Add the following code just below:
div.video {
padding:4px;
border:1px solid $bordercolor;
}
This essentially tells the website that anything classified as a video should use a border that is one pixel large with four pixels of padding. This can be changed to match whatever you use for the image border. Personally, I like the standard Blogger borders. The only problem with this particular method is that you will have to specify a class for any video you post from outside Blogger. For example, if you want to post a video from YouTube, it would look like this:

<div class="video">YOUTUBE EMBED CODE HERE</div>

I also like to keep the video size consistent with the margins of my blog, something necessary for the borders to look right. For this, I will assume that we are talking about YouTube videos. This is the original code for a video:

<object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/hcaNZ4iHSMw&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/hcaNZ4iHSMw&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object>

Here, the video is 480 pixels wide and 295 pixels tall. This is a problem because my blog is 410 pixels wide, and the video will overflow and look wrong. We need to change both widths to 400 pixels (or whatever the margins of your blog are minus the border) and adjust the height to match the new width while maintaining aspect ratio.

<div class="video"><object style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 236px;"><param name="movie" value="http://www.youtube.com/v/hcaNZ4iHSMw&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/hcaNZ4iHSMw&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="246"></embed></object></div>

The more observant of you might have noticed that the object portion of the code has been altered to align the video within the borders, and that the height is 10 pixels less than the embed part of the code. We have subtracted the size of the border on the top and bottom. You may have to play around with the height to make the border even on all sides. Also of note is that the same tags for the video can be used for pretty much anything. For example, the code excerpts in this post use the same div class tags as videos. Here is an example of what the final product looks like:

July 16, 2009

Add an RSS Button to Blogger Posts

I recently made two upgrades to my blog, both of which took me a few hours to get to work right. The first change was to add an RSS Subscribe button at the bottom of each post. My second change was to add a border around the videos I post, in an effort to keep consistency with the borders around photos. In this first post I am going to show you how to add the RSS button at the bottom of each post, assuming you use a Blogger template.

The first thing you need to do is sign in to Blogger and then click the "Layout" button.

Once you've done that, click the "Edit HTML" button and then click the check-box for "Expand Widget Templates".

Look for the lines with the following text in your website code:
<!-- email post links -->
<b:if cond="'data:post.emailPostUrl'">
<span class="'item-action'">
<a href="http://www.blogger.com/%27data:post.emailPostUrl%27" title="'data:top.emailPostMsg'">
<img alt="''" class="'icon-action'" src="http://www.blogger.com/%27http://www.blogger.com/img/icon18_email.gif%27" height="'13'" width="'18'/" />
</a>>
</span>
</b:if>
I apologize for the lack of proper formatting in the code excerpts, but Blogger has a tendency to not like code examples. To add the RSS button, add this code just below the end of the email link code:
<!-- subscribe rss feed -->
<span class='item-action'>
<a href='http://feeds.feedburner.com/Cheese-Wheel' rel='alternate' type='application/rss+xml'>
<img alt='' src='http://www.feedburner.com/fb/images/pub/feed-icon16x16.png' style='vertical-align:middle;border:0'/></a>
<a href='http://feeds.feedburner.com/Cheese-Wheel' rel='alternate' type='application/rss+xml'>Subscribe</a>
</span>
Replace my feed url with your own (you have to do it twice - one for the picture link and one for the text link), and if you have an image you would rather use than the one Feed Burner uses you can substitute the image url. The one provided here is 16px by 16px. By default this will look a little weird, so you might have to alter the code for the email link to get things to line up correctly. You can also change the text next to the icon if you would like it to say something other than "Subscribe," or delete it altogether. Save your template and enjoy your new RSS Subscribe button! In a few days I'll post the second tutorial on how to add a border to videos.

July 14, 2009

Shaving With a Razor Blade

I tried shaving with a razor blade for the first time this morning. It wasn't as bad as I expected it would be. Up to this point, I've always used an electric razor for the convenience and familiarity of it - an electric razor won't cut you as easily as a traditional razor. I've always heard that a blade will give you a better, closer shave and I thought it would be nice to see if I could avoid having stubble even after finishing. Today I was feeling adventurous, and I happen to have a shaving razor laying around. I gave it a try, lightly testing it out and seeing what it could do. Unfortunately, I did not get the idea to use it until after I had already used the electric razor so I don't really know if it did anything special. Actually, it does feel a bit smoother where I used the blade. I will have to try it again in a few days when I have some facial hair to shave.

(Edit: I used the razor this morning to shave and it feels much closer than when I use the electric razor. I knicked myself once, but didn't even feel it. I think I'll be using the razor from now on.)

July 13, 2009

Video Game Nostalgia

An old roommate of mine was in town for this past weekend, and we spent a lot of time chatting about video games. Not surprising since we both love them. Eventually, we got around to talking about games we played as kids. We looked up some videos to reminisce about, and I thought I'd share.

The first game I can remember owning was Lucasarts' Star Wars: X-Wing vs. Tie Fighter. I saved my allowance for months and worked out an advance plan with my parents in order to purchase the joystick and game combination. Back in the day those were amazing graphics, and the game felt very real especially with the joystick. There were days when I would play the game for hours and not want to stop to eat. Of course, I was seven or eight years old at the time and was terrible at the game because I didn't know what was going on. I still to this day have my copy of the game disc and expansion pack, and would very much like Lucasarts to produce a remake. In the meantime, Star Wars Battlefront II will have to do.

Another video game from my early years Star Wars: Dark Forces. I did not actually own this title until many years later, but played it constantly at a friend's house. This was the first FPS game I ever played. My parents wouldn't let me have it as a kid because they thought it was too violent, and I can remember thinking it was a load of crap. It's essentially a Star Wars themed Doom clone, and every bit as awesome if cheesy at times. Since its 1995 release, there have been three sequels including Jedi Knight, Jedi Outcast, and Jedi Academy. Jedi Outcast is one of my favorite games of all time, as is the original Dark Forces. Unfortunately, the series has been played out at this point and the niche filled by other titles such as Star Wars: Force Unleashed.

My third game on this list is also a Star Wars game. Can you tell I was really in to it as a kid? Anyway, the next game I remember well is Rebel Assault II. I've never played the full version of the first game, so that's why I listed the sequel instead. This was another game I played at my friend's house all the time. There were a couple levels of this game that seemed impossible years ago, especially level 3 when you fly a Millennium Falcon look-alike.

This next game, Chip's Challenge, came prepackaged with Windows '95. It's a remake of an older platforming game where you collect computer chips by solving puzzles. The theme song is still stuck in my head to this day. I can remember my sisters and I having a contest with the neighbors down the block to see who could finish the game first. Unfortunately, neither of us ever finished.

There are many, many more games I could mention from my childhood and easily be nostalgic about. However, I feel that four videos take up quite enough space as it is. These examples are simply my favorites and/or the most influential from the bunch.

July 10, 2009

Yelling At the TV

I was just playing some of the side events in Prototype and realized that I haven't yelled this loud at the television since I played Prince of Persia a few months back. There are several things in the game that set me off - poor controls that make the character difficult to control, enemies that swarm you with tanks and shoot so often you have no chance to escape or regain health, and most notably anything that is timed and I come very close to obtaining. The latest time trial I was doing (called Eaves Jumping) required that you collect a series of orbs that serve as checkpoints in 38 seconds or less. Up to this point, my best time was 44 seconds or so. After several tries and several outbursts over poor control schemes and a difficult to control character, I came extremely close with a time of 38.4 seconds. I missed the time cutoff by a measly four tenths of a second! As expected, this elicited a cry of "YOU MOTHERF****ING PIECE OF S***! NOOOOOO! WHY?! WHY DO YOU F***ING TORTURE ME WITH THIS BULLS***?!" that I'm sure the neighbors heard quite clearly. After slamming the controller into a soft surface for a few seconds, I collected my composure and reminded myself that I was trying not to avoid this kind of behavior. I then looked up a tutorial video on YouTube only to discover that I had the right idea, but poor execution. This calmed me down enough to try again, and sure enough it was smooth sailing to a time of 36.5 seconds, a platinum medal, and a much needed break from the game. I've posted the video I used below so you can get a sense of the time trial I was attempting.

July 9, 2009

WTF Dreams

Today I'm going to take a break from video games and write a bit about a couple dreams I had this morning. The first dream I had centered on competing with this guy, who I don't recall seeing, for some woman's affection. There really isn't a whole lot I remember about this particular dream except that there was a point system that would add points when one of us did something good. I also remember being neck-and-neck with this douche and eventually losing. That's right: I lost in my own dream, something that seems to happen a lot. When I woke up I had a sense of longing for a person to connect with, to be with. This doesn't seem like an accurate description of what I felt, and might make me seem like a loser pansy, but it's the best I can give you.

The second dream I almost don't want to describe because it was very disturbing. It started at a generic outdoor school, with a bunch of people dressed up. I jogged to the end of the hall and turned the corner to the right, nearly knocking over a troop of girl scouts as I did so. I can vividly remember that they were all grown up, not the children the word "girl scout" brings to mind, and they were wearing green skirts and green converse shoes. I do not know why they were there, but whatever. I jogged a little further past some more people and came out next to a stage with a bunch of chairs in front, lined up in two groups on either side of a central isle. I sat down in the second row on the right. I think my eldest sister was sitting to my right. Bag pipes started playing and I could see my sister's boyfriend in army dress clothes with two other soldiers bringing a casket to the stage. The coffin was the cheesy kind you see in bad Dracula movies, except it was covered in nondescript bumper stickers. This was a funeral of some sorts, presented in the style of a presentation. That is to say, it didn't feel like what it was. The three soldiers set the coffin down, and the bag pipes stopped. The main soldier opened the lid and then proceeded to mess with the contents with the help of the man across from him. I clearly remember wondering, "What kind of funeral is this where they would disrespect the remains like that?" It gets worse. They propped the skeleton up and then the leading soldier picked the skeleton up by the neck and showed it to the crowd. This wasn't the kind of skeleton you think of at Halloween, white and harmless. This one was still had bits of seared muscle attached, charred spots of bone peeking through. There was no flesh left on the skull, and the jaw was contorted in pain. The soldier holding the deceased man began a speech about how this man died oversees when some evil-doer made an explosive out of refrigerator acid. I don't think there is such a thing, but whatever. He mentioned that the explosive had brought the building down and killed the man he was holding. I recall thinking that I might vomit at this point; whether I felt it or thought it, I can't remember. The soldier then set the body back in the casket and pulled out some kind of chisel or hammer or something. The audience was then sitting in some kind of burned out destroyed building, not unlike the remains of the building the skeleton man had died in. The soldier began tapping the walls gently to show that even the slightest touch was enough to break through walls and floor. He was demonstrating that the building's structural integrity was very weak. At this point, I turned to my sister and said, "I need to get out of here." And then I woke up, feeling very, very disturbed. The image of that charred skeleton is still fresh in my mind.

How about you, do you have any dreams that are weird, scary, or funny? Please feel free to leave a comment with your stories.

July 8, 2009

Fallout 3: Mothership Zeta

While I'm still finishing Prototype, I figured I'd write a little about the next video game purchase I plan to make. The upcoming downloadable content (DLC) for Fallout 3 is entitled Mothership Zeta, and will feature an alien abduction in the Capital Wasteland. For those of you who have played the game, you may remember coming across a crashed alien ship with a usable alien weapon (arguably one of the best, but with limited ammo). The plot of this DLC is that the pissed off aliens are answering the distress call the crashed ship was transmitting. Once the player has been abducted, most (if not all) of the quests will take place on the ship.

I truly don't know what to think about this idea. On the one hand, you have a far-fetched story of an alien abduction in a post-fallout world based on a combination of 50's era life and science-fiction. It just doesn't seem to fit the feel of the rest of the game. On the other hand, there was an alien ship already in the game and the time setting of the game does allow for UFO sightings. The different color pallet and art style will also be a nice change; there are only so many shades of brown you can see before you've seen them all. There is currently very little information on the DLC, but when there is something it will be posted on the official Fallout 3 website. Check it out for more information. Based on previous expansions, I am willing to believe it will be worth the $10 price tag. Since I have enjoyed Fallout 3, I plan to purchase Mothership Zeta when it is released at the end of July.