Nov 20
Aftertaste: Book Review
icon1 Krishnamurthy Koduvayur Viswanathan | icon2 books | icon4 11 20th, 2011| icon3No Comments »

Aftertaste: A Novel in Five CoursesAftertaste: A Novel in Five Courses by Meredith Mileti

My rating: 4 of 5 stars

I found this book when I was checking out the newly released shelf of a bookstore. Needless to say, any story that has anything to do about food immediately catches my attention, be it a novel or a movie. This particular novel kept my interest going when I burned through the first few pages. I immediately checked the ratings on Amazon, and back then it only had five stars (although just a few of them). While this is not a sufficient indicator of a good book, I do use it as one of the parameters (especially to weed out books that I don’t want to spend my time reading).

The story is about a chef-owner in NYC who is trying to deal with her life after a recent divorce. The narration sounds almost like a memoir, and is full of familiar mentions of food, restaurants and people that you will recognize if you are a culinary enthusiast. Even if you are not, it is a great story with some very likable characters. This book is about how the love for cooking helps a woman find balance in life. It is also about family, and friends who love her. If books were food, then this novel is like some chai and pakodas on a rainy day, or like meatloaf and mashed potatoes on a cold winter night.

This book is definitely a keeper. It is going into my collection, to be fined under “comfort reads”.



View all my reviews

Nov 18
Home baked biscotti
icon1 Krishnamurthy Koduvayur Viswanathan | icon2 cooking | icon4 11 18th, 2011| icon3No Comments »

It has been a while since I baked something interesting. I’ve been reading this novel Aftertaste, where the female protagonist makes biscotti whenever she has people visiting her. I’ve always liked a biscotti with a cup of good espresso. So I thought, why not try baking it. Mira makes it sound so easy. And if I may say it, this might be one of the best things that came out of my oven in a long time. Here goes…

Ingredients:

  • 3 cups flour,
  • 1.75 cups sugar
  • 1 tsp salt
  • 2 tsp baking soda
  • 2 tsp vanilla extract
  • 1 large orange
  • 3/4th cup sliced toasted almonds
  • 3/4th cup dried cranberries
  • 3 eggs
  • 4 tbsp butter (unsalted) at room temp
  • 4 tbsp butter – melted

Sift together the flour, baking soda and salt together using a sieve.

Meanwhile toast the sliced almonds in a pan till they start giving off a wonderful almond odour. Take care not to burn the almonds. To make sure they are done, bite into a piece; it should be nice and crunchy.

Whisk together the sugar and the room temperature butter until the butter is well incorporated into the sugar. Mix this well into the flour mixture. Make sure there are no large lumps.

Take half a cup of this mixture in a small bowl, and zest the orange into it.

Use your fingers to knead the orange zest into the flour. It will instantly start smelling really good. Add the toasted almonds and the dried cranberries and mix it well till all the pieces of nuts and berries are coated with the flour mixture. Meanwhile pre-heat the oven to 350 F.

In a separate bowl, squeeze the juice of the one orange into the melted butter. Add the vanilla extract. Add the three eggs and whisk well till the mixture is uniform.

Add one cup of the dry mixture into the wet mixture and start whisking slowly till it is fully incorporated. This is important. Keep adding more of the dry mixture and keep incorporating it slowly.

When the mixture comes together (even though it might be wet), turn the mixture on to a well floured board, and start kneading.

Add more flour if necessary. Stop when the dough comes together into a ball. Use a bread knife to cut the ball into six roughly equal pieces. Roll each piece into a log about 10-12 inches long

Use two baking sheets, and places three logs on each, evenly spaced. Gently flatten them with your hands.

Bake the logs for about 25 minutes, rotating the sheets halfway in between. The logs should be slightly firm to touch.

Let them cool completely (about 20 minutes) before cutting them. This is important. Use a good serrated bread knife to make diagonal cuts as shown.

Place the pieces on the two sheets and pop them back into the oven for 6 minutes.

Take them out of the oven, flip the pieces over and rotate the sheets. Bake them for another 6-8 minutes. Let the pieces cool and crisp completely.

Enjoy with some good coffee, or just by themselves.

Oct 9
Running Spotify on Ubuntu
icon1 Krishnamurthy Koduvayur Viswanathan | icon2 linux, software | icon4 10 9th, 2011| icon3No Comments »

I found it really painful that I could not run the Spotify Linux client natively on my Ubuntu box because I have a free Spotify account. I was recently told that I could try running it using Wine. For some reason, I have never really given Wine much thought, but this was enough incentive for me to give it a shot.

It was not really straightforward, but the following worked for me:

  1. Install Wine: Open Synaptic package manager, and select Wine. Click apply.
  2. Open the “Configure Wine” feature. Click on the audio tab, and select OSS drivers. Set hardware acceleration to emulation. Keep the other default values. Click OK.
  3. Download the Spotify Windows Installer on to your local disk. Right click it, select the permissions tab, and select the “Allow executing file as program” checkbox.
  4. Right click the executable and select “Open with Wine….” option.
  5. After the installation, launch the client (it automatically launched for me).
  6. Try playing a song from your Spotify playlists. If it works, then you are golden, else look further.
  7. In my case, it reported to have a problem with my soundcard.
  8. For some reason, if I launch Spotify directly using Wine as wine “C:/users/kv/Application Data/Spotify/spotify.exe” (or whatever the executable path is on your machine”, it was not using the right audio drivers).
  9. So I try using padsp, which is the PulseAudio OSS wrapper which I think came natively bundled on my Ubuntu box.
    padsp starts the specified program and redirects its access to OSS compatible audio devices (/dev/dsp and auxiliary devices) to a  PulseAudio sound server (directly from the man page).
  10. Running it as padsp wine “C:/users/kv/Application Data/Spotify/spotify.exe” worked for me. Sound works without a hitch. I created a launcher on my desktop with the command above. Now I can run spotify on linux using wine with a double-click.

Sep 27
Book Review: More Tales of the City
icon1 Krishnamurthy Koduvayur Viswanathan | icon2 books | icon4 09 27th, 2011| icon3No Comments »

More Tales of the City (Tales of the City, # 2)More Tales of the City by Armistead Maupin

My rating: 4 of 5 stars

I found the first tales of the city book at a library used book sale in New Jersey. It was a while before I picked up the first installment of “tales”, and I loved the characters right away.

More Tales of the City is the second installment in this series and it brings in more of the good things. Maupin’s writing is spellbinding, witty and funny. The amazing thing about this book (and the first one) is how little third person narrative is there. Most of the book is just dialogues (such good dialogues!) between the extremely well sketched out characters (both straight and gay) who are so human and charmingly flawed and lovable. The second book ties up a few loose ends from the first installment and makes the story-line more interesting.

Despite it being a signature Maupin novel, there are a few surprising elements of sleuthing. The mystery elements are well spaced out into the plot of the book.

The character of Michael Touliver is larger than life, and one wonders where Maupin got the inspiration for him. One of the most sensitive and well written pieces in the book is the letter in which Michael comes out of the closet to his parents. It is amazing to think that this story was written decades ago. One would think it is based in the San Francisco of today, if it were not for pop-culture references of the time.



View all my reviews

May 25

SVMlight provides the option to perform leave one out cross validation using the -x switch. The problem is that leave one out is too expensive for moderately large datasets. If you want to do say 10-fold cross validation, then you need to manage the folds yourself. I finished writing an n-fold cross validation functionality for NetSVMLight. An example follows, which demonstrates how you can use cross validation to pick the values of parameters to train your SVM.

For my problem, the parameter I was trying to pick was the cost-factor -j. In general, the principled way of doing this is as follows: Perform 10-fold (or n-fold) cross validation for each value of the cost-factor, on the training dataset. Get the average accuracy, precision, and recall for each set of models (where the set of models is the n-folds). Pick the value of the cost that gives the best cross validation results. Now the best results are determined by your requirements, and whether you are willing to trade off some recall for some additional precision etc. With the selected value of the parameter (cost-factor in this case), train a new model on the entire training dataset.

Now the basic idea behind n-fold cross validation is that the training dataset is divided into n-folds. In case of stratified cross validation (which is what NetSVMLight does), each fold contains approximately the same proportion of positive and negative class labels as the entire dataset. Also, each feature vector is randomly assigned to one of the n folds. This ensures a fair distribution. Now using a pre-determined value for all parameters, a model is constructed using n-1 of the n folds. This model is then tested on the remaining unseen fold, which yields a value for precision, recall and accuracy. This process is then repeated n-1 times. Each fold is used once for testing. The results of each fold are averaged and reported as the results for the n-fold cross validation.

Hence, in order to pick a parameter, such an n-fold cross validation is performed for each value of the parameter to be chosen. The value of the parameter that gives the most desired cross validation results is picked.

In the code above, the ConstructNFolds method first constructs each of the n-folds on the disk. In the first for-loop, ten different values for the parameter are tried (you can try as many as you wish). The results of each cross validation set are stored in a dictionary, along with the corresponding value of the parameter being tested. The foreach loop simply goes over the dictionary, and saves the results to a file and prints them to the console.

For my dataset, I tried 10 different values of the cost-parameter and recorded the corresponding precision, recall and accuracy from each run of the 10-fold cross validation.

At cost = 0.75, I think there is a reasonable tradeoff between precision and recall. Hence I pick this value and train my SVM over the entire training dataset.

The latest source and binaries can be downloaded here or checked out using SVN.

May 24

I saw this recipe in an episode of Oliver’s Twist, and could not wait to try it. It is a complete entree and it is amazing how quickly it is ready.

Here are the ingredients (serves 2, or 1 if you have a really big appetite). The quantities are very approximate.

  • One large piece of chicken breast
  • 8-10 stalks of asparagus (woody ends removed)
  • 8-10 cherry tomatoes
  • a few tablespoons of olive oil
  • a few mint leaves
  • about half a cup of red wine
  • salt and pepper to taste

Filet the chicken breast into two or three slices. Make a few slits on each piece. This will let them cooker faster and more evenly. Season each piece with salt and pepper. Heat some olive oil in a pan and place the pieces of chicken into it. Keep the heat on at medium high, and let the chicken sizzle.

Place the asparagus around the chicken and let it cook for a couple of seconds. Chop the cherry tomatoes into halves and add them to the pan.

Cook till they start to break. Turn the chicken over, making sure that both sides are nicely brown and sizzling. Add a few mint leaves.

Add some more salt and pepper and drizzle with some olive oil. Add a blob of butter. As it starts to melt, add the wine. The sauce will come together in a minute as the butter melts.

Turn off the heat and serve immediately.

May 9
NetSVMLight: A .NET Wrapper for SVMlight
icon1 Krishnamurthy Koduvayur Viswanathan | icon2 development, programming | icon4 05 9th, 2011| icon3No Comments »

Thorstein Joachim’s SVMlight does not need an introduction to the relevant audience. For windows it comes as a pair of binaries that can be run on the commandline. The software is originally written using gcc. I am not very good at using C/C++, but had some specific requirements where I had to run several experiments and analyze the results. Doing this on the commandline was extremely tedious, and naturally I was looking for an SVMlight API in Java or Python.

There are a bunch of extensions and additions listed on the website that provide an interface to SVMlight. Most of these (atleast the ones in python) simply provide an interface to set parameters and run the executables from within the code. Atleast one of the Python extensions did not have the ability to support different kernels. I was finding it hard to understand some of them due to insufficient documentation. Then I thought of writing one in C# simply because I did not find one featured on the SVMlight page. Here is a list of features:

  • Well documented
  • Strongly typed parameters for svm_learn and svm_classify
  • Supports all kernels provided by svmlight
  • Supports most commonly used parameters (including kernel params and cross validation)
  • Can provide support for others parameters upon request
  • Constructs training and test sets from a given dataset and percentage split
  • Creates a list of all misclassified instances for further analysis

Here is an example usage:

You can download the source, binaries and documentation from:

http://code.google.com/p/net-svmlight/

May 8
Thank your friends on Facebook…more Graph API
icon1 Krishnamurthy Koduvayur Viswanathan | icon2 development, programming | icon4 05 8th, 2011| icon3No Comments »

I am going to get a lot of flak for this post. In some sense it is like digging my own grave, but I think the geek in you might be able to appreciate the ability to do something cool (even though it may take more time to create), rather than the monotonous repetitive.

It was my birthday yesterday. I was overwhelmed by the number of friends who wished me on Facebook, and I really wanted to thank each one of them by commenting on each “Happy Birthday” message. But when the number of such wishes runs into an unmanageable number, then you know that manually sitting and typing “thank you” (leave alone a more personalized thank you) seems to be quite daunting. Now, I declare a disclaimer that I really do thank all my friends for their good wishes, but I could not resist the idea of automating the process of writing thank you messages in response to each birthday wish.

So I set out with the assumption, that for each birthday message on my wall, I will create a comment carrying a personalized thank you, with my friend’s first name. This seemed like a worthwhile thing to do, since I would be able to individually thank each of my friends; and considering that the only other alternative was to be lazy and do nothing at all (since I was not going to be able to do this task manually).

So I set out to hack a python script using the Facebook Graph API. A few things to be considered:

  1. When you retrieve items from your wall, facebook usually returns multiple pages of data. After playing around with this for a while, I did not want to play with it, simply because it was increasing the complexity of what I wanted to do, and I was plainly finding it difficult to understand the meaning of their paging parameters.
  2. So I determined that starting from the newest post on my wall, there were not more than a hundred posts that were birthday wishes (some of them were not, and would need to be filtered away).
  3. I decided to identify the birthday wishes using the criterion that such a message would contain the word “happy” in it (simply because there were different ways in which people wrote birthday e.g. bday, budday and various others). This may not be a very smart filtering mechanism, but it seemed to have pretty good precision for me, and I was willing to let go of the minor loss of recall (I would deal with these exceptional cases manually).
  4. So here is the basic algorithm:
    • Get the list of the 100 most recent posts on my wall
    • If the post does not contain the word “happy”, or already has a comment on it, or doesn’t contain a “message” section in the JSON response, then discard it.
    • Else, extract the messageID, and make an additional HTTP request using the ID of the message sender to determine the sender’s first name
    • Make a new HTTP post to https://graph.facebook.com/messageID/comments using the appropriate access token to write the comment.
  5. One final note about access tokens: The list of wall posts could be obtained using the access token described in my previous post about the Facebook Graph API, but in order to be able to post on my wall, I needed another access_token that would contain write permissions. So, I had to implement the OAuth authentication workflow and request the publish_stream permission. This procedure is not documented very well on http://developers.facebook.com/docs/authentication/.
    • Essentially, I made a request to
      https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=http://www.facebook.com/connect/login_success.html&scope=publish_stream

      This made my application request me for write permission to my wall. Since, I am the app creator, I authorized it.

    • This returned a code in the redirect URL, which I used to make another HTTP request to
      https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&redirect_uri=http://www.facebook.com/connect/login_success.html&client_secret=YOUR_CLIENT_SECRET&code=CODE_FROM_ABOVE
    • The response contains a new access token that can be used for write operations.

    Armed with this new access token, and the old one I already have, I could now read posts on my wall, and write comments to them. Here is the code in Python:

    One final thing: there were at-least two posts on my wall, that were completely missed by the Graph API, and no matter what I did, they were just not retrieved. I had to respond to these manually.

    May 3
    Round Loaf Challah
    icon1 Krishnamurthy Koduvayur Viswanathan | icon2 cooking | icon4 05 3rd, 2011| icon3No Comments »

    When it was time for me to bake another loaf of bread, I decided to bake a challah, but at the same time, I wanted to try something slightly different. Baking a round challah loaf is really easy, and except for the actual shaping of the loaf, all the other steps are exactly the same as baking a regular braided challah.

    So after letting the dough rise for a second time, cut the dough into four roughly equal sized pieces. Incorporate some raisins and other dry fruits into the dough if you like. Roll each pieces into a roughly foot long rope. Arrange the ropes across each other as shown:

    Now pick the strand that is under another, and place it over its neighbour in a clockwise direction as shown (this is the right hand side strand that is in front of you).

    Do the same with the other three as well.

    Now we pick the left hand side strand in front and move it in a counterclockwise direction over its neighbour.

    Do the same with the three others. Move in a counterclockwise direction.

    At this point, you may not have enough left in order to go another round. In that case, pinch the ends together and form a round shape.

    Now bring the edges together from four corners and flip it over. Tuck the bottom in to form a nice dome shaped loaf.

    Let it rise for about 30 minutes to an hour before applying eggwash.

    Bake it in a pre-heated oven at 350 F for about 30-40 minutes. The bottom should make a hollow sound when knocked.

    Apr 29
    Spaghetti with Tomato and Apple Sauce
    icon1 Krishnamurthy Koduvayur Viswanathan | icon2 cooking | icon4 04 29th, 2011| icon3No Comments »

    Don’t let the funny name discourage you. I saw this recipe presented by Lydia on Food Network, and by the end of it, I decided to give it a try. The recipe, originally from Val di Non, Italy, calls for celery, apples, fresh tomatoes, and Grana Padano. I did not have some of this in my pantry, and had to improvise. Here is my version:

    Ingredients (serves 1)

    • Spaghetti for 1 (difficult to quantify this because of the shape of the pasta. I would guess, about 1/4th of a box of Barilla, but use your own judgement)
    • 1 fresh apple (granny smith or gala will do okay)
    • 4-5 little red radishes (the round variety), chopped
    • 1 small onion, finely chopped
    • 1.5 cups tomato puree (you can either make it fresh or use canned)
    • 3 tbsp extra virgin olive oil
    • salt and pepper to taste

    Method

    Add the chopped onions and radishes to the olive oil in a pan and saute until they start to caramelize.

    Meanwhile, peel and core the apples. Store them in salted water to avoid letting them turn brown.

    Add the tomato puree to the pan and let it cook for about 5 minutes. Add some salt and pepper to taste and simmer till the sauce bubbles.

    Meanwhile, use a chopper to chop the apples into very small pieces. Better yet, use the coarse holes of a grater to grate the apples. Stir in the apples into the sauce and let it cook uncovered for about 10 minutes. Splash some water if it evaporates too quickly.

    Bring a pot of salted water to a rolling boil, and add the spaghetti to it. Cook it uncovered until barely al-dente.

    Check the sauce for seasoning, and turn off the heat once the sauce has thickened and the apple shreds are well cooked and incorporated into the sauce.

    Now add the spaghetti to the sauce and finish cooking it in the sauce. This is standard procedure for cooking most pastas. They must be finished off in the sauce.

    Toss the pasta in the sauce until it is well coated. Turn off the heat and drizzle with some more olive oil if you wish.Heap it on a plate/bowl and serve hot with bread.

    « Previous Entries