Skip to main content

Posts

Terris' Easy Spicy Vegan Lentil "Soup"

Lentils

This a recipe for cooking raw lentils with Indian flavors.

Most of the liquid will be absorbed by the lentils so this dish will be more of a cassole than a soup. This recipe yields 10-12 large bowls. Great for leftovers and lunch-at-work!
Credits: I started with this recipe
Estimates: Prep time: 30-45 mins, depending on whether you have help chopping or drinking Cook time: 20 mins Ingredients 1 bay leaf3 Tbsp salt1 Tbsp cumin1 tsp curry powder2 tsp roasted paprika1/2 tsp garam masala1 tsp roasted chipotle powder 4 yellow potatoes6 oz crimini mushrooms, sliced1 cup dry lentils1 fresh jalapeƱo finely chopped1 large yellow onion1 pound cherry tomatoes - or add two more tomatoes1 large whole tomato3 carrots, chopped1 lb cauliflower, chopped1 lb broccoli florets, chopped6 oz tomato paste2 Tbsp olive oil1lemon, juiced (about 2 tablespoons)3 cups vegetable broth InstructionsSautee the oil, garlic, and onions for 5 minutes in medium-low heat in pressure cooker (no pressure yet!)While …
Recent posts

Upgrading brew

brew complaining that it doesn't support a prerelease version of OSX? Here is the only fix. A mere "brew update" will not work.

cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update

MySQL: This stored procedure inserts 'empty' rows into a specified table

This stored procedure accepts two arguments: a table name and a row count. It inserts the specified number of rows into the specified table. Of course, all columns in the table must either have default values or allow NULL.DROP PROCEDURE InsertDimension; DELIMITER $$ CREATE PROCEDURE InsertDimension(IN TableName VARCHAR(50), IN NumRows INT) BEGIN DECLARE i INT; SET i = 1; SET @sql_text = concat('INSERT INTO ', TableName, ' VALUES ()' ); PREPARE stmt FROM @sql_text; START TRANSACTION; WHILE i <= NumRows DO EXECUTE stmt; SET i = i + 1; END WHILE; COMMIT; DEALLOCATE PREPARE stmt; END$$ DELIMITER ;

Collecting and graphing metrics via Apache Camel, Statsd, and Graphite

If you're curious about Apache Camel's metrics reporting via Dropwizard, this guide will help you get Graphite running in a Docker container. Then you will run an instrumented Camel application and view its metrics via Graphite's browser UI.

(1) Install Docker

There are many ways to do this depending on your platform. Google it.

(2) Install and run the Docker container for Statsd and Graphite

Refer to https://github.com/hopsoft/docker-graphite-statsd

The instructions infer that you can run the container without specifying port mappings. This is plain wrong. So use the following command to start the container:

docker run -d --name graphite --restart=always -p 80:80 -p 8125:8125/udp hopsoft/graphite-statsd It is not necessary to enable Graphite's UDP listener. Statsd receives metrics via UDP and forwards them to Graphite over TCP. (3) On Windows and OSX, determine the IP address of the graphite Docker container

On Linux, you can use localhost.

On Windows and OSX, there are…

Load testing with Java: Pound on a resource with multiple threads

Load testing involves multiple threads or processes performing operations against a resource. For example, execute a query against a database server via 50 concurrent threads. The tricky part is waiting for the threads to start up before the commands are actually executed, in order to make sure that the resource is truly getting hammered. Here's an example of how to accomplish this in Java. It is possible to refactor the following code into a utility accepts two parameters: the number of threads and a lambda expression which can be passed as a Runnable object.
final int numThreads = 50; ExecutorService executor = Executors.newFixedThreadPool(numThreads); CountDownLatch ready = new CountDownLatch(numThreads); CountDownLatch start = new CountDownLatch(1); CountDownLatch done = new CountDownLatch(numThreads); for (int j = 0 ; j < numThreads ; j++) {    executor.execute(() -> { ready.countDown(); try {    start.await(); // do something here ... } catch (InterruptedException ex) { …