Thai Curry Tofu

Ingredients

  • 1 tablespoon canola oil
  • 1 (12 ounce) package extra-firm tofu, drained and cubed
  • 1 tablespoon seasoned salt, or to taste
  • 1 tablespoon butter or margarine
  • 1 small onion, chopped
  • 3 cloves garlic, minced
  • 1 (10 ounce) can coconut milk
  • 2 teaspoons curry powder
  • ½ teaspoon salt
  • ¼ teaspoon ground black pepper
  • ¼ cup chopped fresh cilantro

Instructions

  1. See the following for instructions on how to cook the tofu.
  2. Melt butter or margarine in the same skillet over medium heat. Add the onion and garlic; cook and stir until tender. Stir in coconut milk, curry powder, salt, pepper and cilantro. Return the tofu to the skillet. Simmer over low heat for 15 minutes, stirring occasionally.

Baseline Settings for a VirtualBox Instance for a GUI under Debian 10

The following is a list of the basic VirtualBox settings to start with when using a VM with a GUI. Make sure that you have also installed the Oracle VM VirtualBox Extension Pack that is compatible with your version of VirtualBox and that you have installed the Guest Additions in the VM itself.

  • System
    • Motherboard
      • 4+GB of RAM, or whatever you have available
    • Processor
      • 2+ CPU (if you have the available cores/threads)
  • Display
    • As much Video Memory as you can spare
    • Graphics Controller: VMSVGA
      • Ensure that 3D Acceleration is enabled

Mousse au Chocolat or Chocolate Mousse Recipe

Serves 8 to 10

  • 4 x 1 ounce-squares unsweetened chocolate
  • 3/4 cup sugar
  • 1/4 cup water
  • 6 eggs, separated
  • 2 tablespoons dark rum
  1. In top of double saucepan combine chocolate, sugar and water. Cook over hot water, stirring occasionally, until chocolate is melted.
  2. Add egg yolks, one at a time, beating well after each addition. Remove from heat; cool.
  3. Meanwhile, in mixing bowl beat egg whites until stiff but not dry.
  4. Stir rum into chocolate mixture; pour over egg whites. Fold gently until well blended.
  5. Turn into individual dishes or large serving bowl. Refrigerate for 12 hours.

message=class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext When Mocking Static Methods in Class

When mocking static classes with Junit4, Mockito and PowerMock, you may see the following log messages after annotating your test class if the code that you are testing is making HTTP connections:

message=class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLSContext not a SSLContext

Your annotations for the class (or method) typically include the following:

@RunWith(PowerMockRunner.class)
@PrepareForTest({ SomeClassYouWantToMock.class })

This may cause some confusion, especially if whatever other code that you may have ONLY uses HTTP. Add the following to your annotations to tell PowerMock loading of the following classes.

@PowerMockIgnore({ "javax.net.ssl.*" })

This should prevent PowerMock from loading different class definitions that are used by your HTTP library.

Creating a Counter or Progress Bar for a Python Program

I’ve written a number of Python apps where I would like it to print some sort of counter or progress bar to STDOUT to let me know that it is still running instead of locked up or died somehow without me being able to see it.

I had tried using a couple of different existing progress bar related modules but none of them really worked except in a very specific use case.

So, after a bit of futzing around I came up with a very simple way to print out a updating counter to STDOUT. The synchronization code was gleaned from this post here, thank you Daniel.

Following is a working example for Python 3.7. You could write your own implementation of the progress function to render whatever you want to STDOUT.

import threading
import sys
import time

def synchronized(func):
    func.__lock__ = threading.Lock()
    def synced_func(*args, **kws):
        with func.__lock__:
            return func(*args, **kws)
    return synced_func

total = 0

@synchronized
def progress(count):
    global total
    total += count
    sys.stdout.write(f'\rtotal: [{total}]')
    sys.stdout.flush()

for i in range(500):
    progress(1)
    time.sleep(0.01)

print(f'\nFinished...')

Running this will generate the following output with the total value dynamically updating as the application runs:

(progressbar) rchapin@leviathan:progressbar$ python progressbar.py 
total: [500]
Finished...