If you have a digital multi-meter with "Diode Test" feature, you can use it as a connection tester (Here we it call a "Beep-Check" :D), you will simply find out what pin of the A-side connector is connected to the B-side connector. Learn the order of connections because it is a convention to connect pins of these flat-cables in that way.
Next you will have to simply connect MOSI to MOSI, MISO to MISO, SCK to SCK and absolutely the NRST to NRST (as other friends said, it is better to pull-up NRST using a 10K~47K resistor - however the AVR already has this resistor. It is just for precaution).
AND DON'T FORGET THE "GND" PIN! Every two device with electric link must have common GROUND.
I must add and remark something to addition to what my friends, JYelton and Nick said:
Please make sure that your ATmega8 (or whatever IC you are using) is powered from the external adapter (+5V) OR from the programmer. Not BOTH OF THEM!!!
Otherwise, you may damage your computer's USB port, or the adapter (or in some cases even the programmer and the microcontroller)!!