Saturday, July 31, 2010

Quick fix for Your gPodder YouTube feeds

YouTube changed something last month, and my YouTube feeds in gPodder started producing "404" errors.
Thomas Perl has already submitted a fix, but who knows when new packages will actually be released. And the Ubuntu package is two versions behind already.

So... If you're not afraid to edit a script file, you can fix your own installation while waiting for the new packages.

Now, I have to admit that I don't know how to edit as "root" using the graphic text editor, gEdit, but hopefully some will add that to the comments.

How I did it:
sudo vi /usr/share/pyshared/gpodder/youtube.py

and in the section that reads


   if r2:
      next = 'http://www.youtube.com/get_video?video_id=' + vid + '&t=' + r2.group(1) + '&fmt=%d' % fmt_id
      log('YouTube link resolved: %s => %s', url, next)
      return next
NOTE: That is only one line although it looks like two line on the web page.

Comment out the line starting with "next" and add these two lines:
    d = {'video_id': vid, 't': r2.group(1), 'fmt': fmt_id}
     next = 'http://www.youtube.com/get_video?video_id=%(video_id)s&t=%(t)s&eurl=&el=&ps=&asv=&fmt=%(fmt)s' % d


The final product should look like:
   if r2:
     # next = 'http://www.youtube.com/get_video?video_id=' + vid + '&t=' + r2.group(1) + '&fmt=%d' % fmt_id
     d = {'video_id': vid, 't': r2.group(1), 'fmt': fmt_id}
      next = 'http://www.youtube.com/get_video?video_id=%(video_id)s&t=%(t)s&eurl=&el=&ps=&asv=&fmt=%(fmt)s' % d
      log('YouTube link resolved: %s => %s', url, next)
      return next
(I added to colors to show the change.)

Wednesday, July 28, 2010

Plants vs Zombies Strategy Guide (Part I)

Plants v.s. Zombies appears to be a fun little puzzle game, but it is actually a very well done Tower Defense game. The Tower Defense genre was popularized as StarCraft custom maps. And my PvZ strategy strongly reflects my StarCraft experiences.

This guide isn't going to cover the basic mechanics of the game. There are many web sites out there that explain the different units in the game. Unfortunately, every online guide I've seen uses terrible strategies. With my techniques we will make success on each screen a virtual certainty. And we'll get all the achievements.

To get all the achievements in the game, you need to play through Adventure (aka campaign) mode twice.
I actually employ just my Basic strategies the first time through Adventure.
On subsequent trips through Adventure mode, You may need more Advanced strategies.

The Pattern
Before we delve into the specifics, let's look at the basic pattern:





Basically, the most expensive units go on the left where they are safest from the zombies. On the right, we put a blocking unit and spikes. While zombies are working on the blocking units, they are taking damage from the spikes. Zombies don't eat spikes, and those spikes will stop the mechanical units in the back yard.

Minor variations on this pattern will get you through everything except the Roof levels and the mini games.


Basic Stuff:

  • Produce enough sun to always be building
  • Put the cheapest units in the most vulnerable positions
  • Keep the board balanced



Produce enough sun
Sunflowers are your only source of Sun through most of the game.
In the early stages of a given level, everything should go towards planting sunflowers.
I personally don't like to have any zombies get through in the first pass through Adventure mode, but if you're having difficulty getting enough Sun going, plan to sacrifice some of your lawn mowers early to allow more time for planting Sunflowers.

Sunflowers are one of the cheaper plants. So you want to plant them as far forward as possible to shield more expensive plants. In the early stages of a level, this means columns 3 and 4. I generally fill those columns with sunflowers. Plant shooting plants behind them in columns 1 and 2 and drop the occasional squash if needed to allow this pattern to be built.

If you construct this basic layout early, you will generally have more firepower than the zombies throughout the rest of the board. Just add more damage and defensive units to fill the board as the sun becomes available.

I generally avoid the inexpensive Sun-shrooms on the nighttime levels. They don't produce enough Sun early on to build enough to defend themselves.


Cheapest Units in Front:
Yet another reason to put your sunflowers in front of the Pea Shooters. If you aren't dealing enough damage to stop the zombies before they get your flowers, it's much better for them to eat a 50 point sunflower than a 100 point Pea Shooter. 

The only time I vary from this rule is in the nighttime levels, when I put Scaredy-shroom on the left. They're not expensive, but they are oh-so-delicate...

Keep the Board Balanced:
You don't want to be chasing zombies. After the first few zombies, you just want to implement the pattern you've selected. By balancing the board vertically, you be doing the same damage to any zombie that walks into the field of play.

I rarely employ one-shot units since a balanced board should keep the zombie population down in every row.
Bombs and peppers only get used when going for achievements. The Squash, however,  can be used to buy extra time in the early build phases.


In Part 2, we'll look at specific ways to defend against some of the tougher zombies. Part 3 will cover advanced techniques and achievements.