response

Jack Kornfield on karma related to speech, and intention

I’m not a huge believer in certain types of karma in this world, but Jack Kornfield offers this discussion about karma related to speech, and intention:

“Speech is one area in which karma can be seen in an easy and direct way. For this exercise, resolve to take two or three days to carefully notice the intentions that motivate your speech. Direct your attention to the state of mind that precedes talking, the motivation for your comments, responses, and observations. Try to be particularly aware of whether your speech is even subtly motivated by boredom, concern, irritation, loneliness, compassion, fear, love, competitiveness, greed, or whatever state you observe ... Simply notice the various motivations in the mind and the speech that flows from them.”

“Then, after discovering which motivation is present as you speak, notice the effect of the speech. If there is competitiveness or grasping or pride or irritation behind the speech, what response does it elicit from the world around you? If there is compassion or love, what is the response? If your speech is mindless, as if you were on automatic pilot, what is the response? If there is clarity and concern, how is this received and responded to?”

It brings up an excellent point: What motivates your speech?

ScalaJ-HTTP examples: GET, POST, handling redirects alvin November 22, 2016 - 4:34pm
Table of Contents1 - Handling redirect requests with ScalaJ-HTTP2 - ScalaJ-HTTP GET request example3 - Setting ScalaJ-HTTP timeout values4 - A ScalaJ-HTTP POST request example5 - ScalaJ-HTTP: Summary

If you ever need some good ScalaJ-HTTP examples, see the test files in the project, including this HttpBinTest.scala file. That file currently shows a number of good ScalaJ-HTTP examples, including GET, POST, redirect examples with Scala.

See that page for a full list of examples, but for my own use, here are a few of them.

How to access HTTP response headers after making an HTTP request with Apache HttpClient

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a very short recipe, Recipe 15.12, “How to access HTTP response headers after making an HTTP request with Apache HttpClient.”

Problem

You need to access the HTTP response headers after making an HTTP request in your Scala code.

Solution

Use the Apache HttpClient library, and get the headers from the HttpResponse object after making a request:

How to test for a valid user session in a JSP alvin June 1, 2009 - 8:54am

Note: This approach is very old; Java/JSP scriptlets were deprecated a long time ago. I don't have time to update this article to the correct, modern approach, but I hope this JSP session example will point you in the right direction.

Every once in a while I'm asked something like, "How can I tell if I have a valid user session in my JSP code?"

AppleScript dialog - prompt for a response alvin November 7, 2007 - 5:33pm

A frequent AppleScript question I get is "How do I get information back from a user after I've prompted them with a dialog?" The following example demonstrates how I typically do this. I prompt the user to enter some text, then get their reply back. In this case the reply is stored in the variable named theName.

set theName to the text returned of 
  (display dialog "What is your name?" default answer "")

For your reference, the dialog created by this code looks like this:

Servlet forward example - How to forward from a servlet to a JSP

Here's an example of how to forward from a servlet to a JSP in your J2EE code. I can never remember how to do a forward like this when I need it, so even though this example is pretty easy, I've put it out here so I can find it later.

The typical scenario is that you're working on a Java servlet, and you need to forward the user from that servlet to a JSP. Assuming the name of the JSP is "searchResults.jsp", here's the code that will forward from your servlet to that JSP: