In a large bowl, stir the grated garlic, sugar, fish sauce, lime juice and chillies, until the sugar dissolves.
Bring a pan of water to a boil, then add the beans and whole corn cobs, and cook for four to five minutes, until the beans are crunchy-tender.
Use a slotted spoon to lift the beans straight into the dressing bowl, then add the tomatoes to the bowl and smash them with the back of a spoon to smoosh them up a little.
Drain the corn and, when it is cool enough to handle, stand it up in the bowl. Keeping a sharp knife close to the core, cut down the length of the cob to shuck the kernels into the salad mix (if using frozen corn, just drain and add straight to the bowl).
Put the rice in a sieve and wash under the cold tap, mixing it with your hand, until the water runs clear.
Put the rinsed rice in a pan with 400ml cold water and a half-teaspoon of salt, bring to a boil, then cover and turn down the heat to the lowest setting. Leave to cook for 10 minutes, then turn off the heat and leave, lid on, to steam for another 10 minutes.
To cook the tofu, put the oil in a nonstick frying pan on a medium to high heat and, when hot, add the tofu and cook, turning every couple of minutes, for six to eight minutes, until crisp all over.
Take off the heat, then add to the salad bowl along with the peanuts and Thai basil, and stir to mix.
To serve, spoon a quarter of the rice into each of four bowls or lipped plates, then spoon the salad on top.
