Kevin Kelly recommends two source of food advice:
Cook's Thesaurus is an online database of substitute foods. All out of oats for some special recipe? Try wheatberries or rye flakes or triticale. Still don't have it? At least know the alternatives that might be stocked at your grocery: rolled, steel-cut, groats, etc. each explained with its advantages and disadvantages.
If you really need to be prepared, have this book on hand:
Cooking Ingredients . The Ultimate Photographic Reference Guide for Cooks and Food Lovers (Paperback) by Christine Ingram, contains 1500 different food types and a brief explanation of each.
Next time I'm out of something, I'll try one of the sources above. And if they're not handy, of course I can always go straight to Wikipedia, which is becoming the ultimate reference for everything.