Cook the onions slowly in the oil and butter for 5 minutes or so, until tender but not browned.
Raise heat slightly, stir in ham, and cook a moment more.
Beat the eggs in a mixing bowl with the garlic, herbs, cheese, cream or milk, and seasonings.
Then blend in the ham and onions.
Peel the potatoes and grate them, using large holes of grater. A handful at a time, squeeze out their water. Stir potatoes into egg mixture. Check seasoning.
(*) May be prepared ahead to this point.
Heat the butter in the dish. When foaming, pour in the potato and egg mixture. Dot with butter. Set in upper third of preheated oven and bake for 30 to 40 minutes, or until top is nicely browned. Serve directly from the dish or skillet.