Saturday 1 August 2009

7 tips for baking great pancakes

Tonight, I made some delicious pancakes. I do this every few months, and everytime I get a little better at it. While I was baking pancakes, I tried to think about the things I were doing, which made baking the pancakes a success. I came up with the following 7 tips. Here we go:

1. Use the right ingredients. The base ingredients for pancakes are very simple: flour, eggs and milk. That's all it takes! If you want to make about 10 pancakes you will need about 400g of flour, 600ml of milk and 2 eggs.

To be honest with you, I use a pancake mix from the supermarket most of the time. These usually consist mainly of flour, with some sugar and salt added to them (minor extra taste). If you don't like this (or can't have it), don't use a mix, just use flour.

2. Use the right tools. The most important tool for making pancakes is a frying pan. Picking out the right one is essential to the success of your pancake experience. I typically use a pan that has a slippery bottom and isn't too big. A big pan leads to big pancakes, which means you can eat only one or two and you won't have much variation in taste when you are making pancakes with different toppings.

To turn pancakes around you can use a spatula. I've also seen people slide the pancake from the frying pan onto the lid of a pan which is then turned upside down on top of the frying pan. If you are in for an adventure, you can also throw the pancake in the air, let it turn for 180 degrees and catch it upside down (beware, this will make your kitchen a mess the first few times!).

To pour the batter into the pan, I use a soup ladle.

Finally, to keep the pancakes warm while you a baking more, use a cooking pan filled with hot water (not boiled, just from the tap) and a dinner plate on top of it.

3. Layer your pancakes. This only applies to pancakes with toppings (which make for the best, I think). This is how I do it:

  1. Turn down the heat (but don't turn it off).
  2. Put a small piece of butter into your heated frying pan, let it melt and divide it evenly.
  3. Pour a thin layer of batter into your frying pan and spread it out.
  4. Quickly grab your favourite topping and lay it down onto your (still runny) batter. Softly push the topping into the batter.
  5. Pour a second layer of batter on top of the toppings and spread over the pancake. This will prevent the topping from burning (which often happened to me before I used this technique).

4. Choose your toppings wisely. In my opinion, toppings make the best pancakes. The classic toppings are cheese and bacon. But this isn't where toppings end. For instance, experiment with some fruit or fish. Beware that, whatever toppings you choose, they don't need to be cooked very long. Some of the toppings I've used are apples, bananas, cherries (with Grand Marnier), salmon and tuna. Next to choosing individual toppings, they can also be combined!

5. Use butter each time. When I first started making pancakes I used butter every few pancakes I baked. I found out this doesn't lead to the best results. First of all, pancakes get burned more easily if you don't use butter. Even when I wiggled them around a lot, they tended to get stuck to the pan more easily, which makes it hard for you to turn them around (especially when you are using a topping). Secondly, the bottom of the pancake will become very smooth and a lot harder (or tougher) than the top, which also takes away the soft taste of a pancake.

6. Be gentle with the heat. As I mentioned earlier, pancakes get burned fast. Especially when you turn up the heat. I've noticed it takes quite a bit of patience to bake great pancakes. I usually start with turning down the heat to almost off. Then (after butter) I pour some batter and wiggle the pan a bit to divide the batter evenly. After a few seconds I turn the heat up, but not much. It usually takes about a minute or so before I turn the pancake around. I do this two times more, with about 30 seconds to a minute in between.

7. Bake with love. Finally, if you want to make great pancakes, or heck, great anything, do it with great care and love.

So far for my pancake baking experiences. I hope this is helpful to those wanting to learn something about it. And if you have any other tips, feel free to leave a comment, since I'm eager to learn, too! Oh, by the way, one of the downsides of baking pancakes, is that it takes a while (over an hour in my case) and that it only takes about 10 minutes to get to this:

Wednesday 3 June 2009

Having trouble with HTTP sessions in an Apache httpd, mod_proxy and Tomcat setup?

Today I ran into an issue where a new HTTP session was created for each HTTP request. Besides wasting resources, this can obviously lead to unwanted behaviour, such as locale settings not being remembered, etc. My infrastructural setup was as follows:
  • Apache Tomcat 5.5.25
  • Apache HTTPd 2.2.3
  • mod_proxy (no clue what version)
Before we dive into the solution, let's first try to understand the problem. So, here's what happens:
  1. One of your beloved users sends an HTTP request to your application, for example http://www.example.com/my-app.
  2. Apache httpd receives the request and your mod_proxy configuration matches the request and forwards it to http://localhost:8080/internal-app.
  3. Apache Tomcat receives the request. Let's assume no session has been created before, so your app creates a new one and in response sends a cookie to the browser, which holds the session id for later reference. Now, a cookie needs to have a path set and the default is your context path. Aha! So now a cookie has been created for domain www.example.com and path /internal-app, which is wrong, since the outside world sees the application running on path /my-app.
  4. Your beloved user now sends another HTTP request to your application and the cookie (with the session id) is not sent with it, since the request is for path /my-app and the cookie is set to /internal-app.
  5. Mod_proxy once again forwards the request to Tomcat. Your app will attempt to read a session id from the cookie, but it can't find it. Hence, a new session is created (for each subsequent request, since the paths will never match).
OK, now that we understand the problem, lets try to fix it. I see two possible solutions.

Tell mod_proxy to rewrite cookie paths

The least intrusive method is  to let mod_proxy rewrite the path of cookies being created by your application, which can be done using the ProxyPassReverseCookiePath directive. For example:

        ProxyVia on
        ProxyPassReverse /my-app http://localhost:8080/internal-app 
        ProxyPassReverseCookiePath /internal-app /my-app
        ProxyPass /my-app http://localhost:8080/internal-app

If you're using Apache httpd 2.2 you are in luck, otherwise this won't work :-(

Let Tomcat set the path of session cookies to root

Another way to go around our problem is to configure Tomcat to set the path of the cookie for the session id to the root (/). You can do this by adding the emptySessionPath="true" attribute to your connector configuration in your server.xml (which is located in the conf directory of your Tomcat installation).

A disadvantage of this solution is that it affects your entire Tomcat installation (please correct me if I'm wrong about this).

If you have any other solutions, please feel free to comment!