MegaISP has supplanted most of the functionality of Programmer2.
This programmer will turn an Arduino into an AVR ISP programmer. It is pin compatible with avrusb500 which implements the newer and saner stk500v2 protocol and will eventually be supported by the Arduino IDE, but until then this one exists to work with the older protocol. Perhaps arduino-0009 will support the new protocol.
You can connect this to your Arduino IDE and connect to the ISP port of your target processor. When you 'upload to target' from the IDE the programmer will flash the program into the target and restart it. You do not need to press reset and there is no timeout delay after flashing. Your sketch will run immediately.
If your programmer is a 168 you have room for secondary functions, these are mostly just leftovers from development but some are useful. You access these by connecting to the serial port of the programmer and typing two letter commands, all of which begin with an asterisk.
Look at the UTILITIES and LCD preprocessor symbols. Turn these off to fit in an atmega8.
You will need to make an ISP cable appropriate to your target devices. On the programmer end you must use the following pins or change the definitions:
LEDs for blinking lights, tie to +5 with a resistor.
These 4 signals go into the ISP connector along with ground and possibly power.
I put a tiny 9600 baud serial LCD on to show debugging information. There isn't anything useful on it in this set of code, you don't need it. It breaks the protocol because software serial takes too much cpu time.
You probably don't need these, but I didn't have a hardware reset switch on my tester...
You may or may not want to connect the power line in the ISP. This is complicated. The easiest thing to do is to connect the power line in the ISP, then don't power the target board. This way you will supply the target board from your programmer. You can't do this if the target runs at a different voltage or draws too much current. (This is the method I use.)
Second easiest, you can not connect the power. This is only appropriate if both boards run at the same voltage, but perhaps the target would need too much power to be supplied by your programmer.
If your target runs at an incompatible voltage then you will need to add a level translation circuit of some sort and power each board independently. Since you have both high voltages present, you might get clever with a CMOS switch like a 74HC126N or two.
The source code is found in http://playground.arduino.cc/uploads/Code/programmer2.txt and is built like any other sketch.