Saturday, December 15, 2012

Yellow Curry with Chickpeas and Potatoes


A modified version of this recipe, to respect the people who will be eating my food tomorrow.
Makes 6-8 servings

Ingredients

  • 2 14-ounce can of coconut milk
  • 3 tablespoons yellow curry paste
  • 1 29 oz can chickpeas
  • 1 cup water
  • 2 medium potatoes
  • 1/4 large onion
  • 1 14-ounce can of baby corn
  • 1 teaspoon soy sauce
  • 1 teaspoon sugar
  • 1 lime

Instructions

  1. Slice the onion and baby corn into bite-sized pieces.
  2. Peel, cut, and parboil the potatoes for ~5 minutes. Set aside.
  3. Open one can of coconut milk and scoop the top thicker cream part into a pan.
  4. Heat this cream over medium heat until the oil just starts to separate from the milk.
  5. Then add the yellow curry paste and saute with the cream until it becomes fragrant.
  6. Then add the remaining 1 1/2 cans of the coconut milk and water and bring to a boil.
  7. Let cook until the consistency of the curry is what you prefer. You can use less water if you want a shorter cooking time.
  8. Add the potatoes, onions, and baby corn and cook until just done, but still firm.
  9. Mash 1/2 a potato and add to thicken.
  10. Adjust seasonings with soy sauce and sugar to taste.
  11. Garnish with thinly sliced kaffir lime leaves and red peppers. Serve with jasmine rice.

Wednesday, May 2, 2012

Logging to syslogd from Python


On Unix there is a syslog service that handles centralized logging. Using it for logging from your daemons has the advantage of putting control of the logging options in the hands of the system administrator, without involving you, the developer. If they want certain log rotations, or there is a preferred directory, or if the logs are sent over the network to a central logging server, it has nothing to do with you, as long as you are logging to syslog.

First off, you need a config file something like this:

[loggers]
keys=mysyslogger_l


[handlers]
keys=mysyslogger_h


[formatters]
keys=mysyslogger_f



[logger_mysyslogger_l]
level=NOTSET
handlers=mysyslogger_h
propagate=0

[handler_mysyslogger_h]
# Add this line to syslog.conf
# local1.*         /var/log/distributor.log
level=NOTSET
formatter=mysyslogger_f
class=handlers.SysLogHandler
args=('/dev/log', handlers.SysLogHandler.LOG_LOCAL1)

[formatter_mysyslogger_f]
format=%(message)s

Then, you'll need to read that config file with your Python program:

import logging
import logging.config

logging.config.fileConfig("logging.conf")
log = logging.getLogger("mysyslogger_l")
log.info("This an info message.")
log.error("This is an error message.")

Then you'll probably need to configure your syslog to write the messages somewhere. Add this line to /etc/syslog.conf and run /etc/init.d/syslog restart:

local1.*         /var/log/mysyslog_file.log

Sunday, March 4, 2012

Graphing Gaussian Curves in Octave

I've been working my way through Prof. Sebastian Thrun's second AI course,CS 373 Programming a Robotic Car that he is offering through the new company, Udacity. In week two he covers Kalman filters as a method of estimating location given uncertainty in sensor data and uncertainty in movement.

In an effort to get a better understanding of how the variables affect the shape of the Gaussian distribution that represents the probable state of the variables being modelled, I fired up Octave. Octave is math software that allows the user to do a large variety of things, but in my case I just wanted to use it to graph a Gaussian distribution and see the effect of changing the variables.

Thanks to this helpful, and to the point, post, it was reasonably straight forward to start graphing curves in two dimensions.

x = [1:0.1:6]
sigma = 5

mu = 10
fx = (1/sqrt(2*pi*sigma^2)*exp(-(x-mu).^2/(2*sigma^2)))
plot(x, fx)

This is enough to get started.

Wednesday, January 25, 2012

Gluten Free Bechamel Sauce

2 cansevaporated milk
8 tbspcorn starch
4 Cwater
2beaten eggs
1/2 Cshredded pecorino cheese
1 tbspbutter
1 tspsalt
1 pinchgrated nutmeg
  1. Bring water to a boil.
  2. Add 1 can evaporated milk.
  3. Add corn starch, whisk.
  4. Lower heat to medium.
  5. Add 2nd can of milk.
  6. Add butter.
  7. Whisk lightly until sauce thickens.
  8. Add eggs in slow stream, whisking quickly so they don't cook in chunks.
  9. Add nutmeg.
  10. Take off heat.
  11. Add cheese and mix thoroughly.