Archive for October, 2010
Some killer Code
Thursday, October 21st, 2010Scariest movie when I was a kid
Thursday, October 21st, 2010More uses for baking soda, the pesticide use and wash is interesting
Thursday, October 21st, 2010Easy, effective wash for fresh produce to protect against foodborne bacteria and pesticide residue. The powdery quality of baking soda makes it useful as a gentle scrub for fruits and vegetables, and it’s especially effective for fruit such as pears and apples that you may want to eat raw without peeling. How to use it: Shake some dry baking soda into your hands, rub it over the fruit and then rinse off under your kitchen faucet.
Safe insect repellent to keep ants, cockroaches and other undesirable critters from your kitchen cabinets. Place jar lids filled with water (for the insects to drink) and sprinkle baking soda (for them to eat) nearby on the bottoms of cabinets and under the sink. The chemical reaction of the two together kills the ants. There’s an outdoor version, too — combine a teaspoon of baking soda with one-third of a cup of cooking oil… shake well in a watering can then sprinkle the mixture lightly on plants.
Relief from stinging and itching. If a bee or other insect stings you, make a paste of baking soda and water (aim for the consistency of toothpaste) and rub onto the site — you’ll find that the pain subsides quickly. The reason it works: The baking soda neutralizes the toxins that trigger the pain along with some of the reactive compounds produced in the affected tissue. This paste also is useful in soothing itching from bites by mosquitoes and other insects, as well as for rashes, hives and even poison ivy.
To soothe an upset stomach after a large or troublesome meal. If you can’t get your stomach to quiet down after eating something that disagrees with you (or when you’ve eaten too much), try completely dissolving one-half teaspoon of baking soda in four ounces of water. This is essentially the same compound that your stomach produces to neutralize stomach acid. There are some important caveats: Don’t take within two hours of medications (especially tetracycline, which is used to treat bacterial infections), and don’t take with large amounts of milk (it increases the likelihood of allergic reaction). Don’t use this remedy if you are on a sodium-restricted diet for high blood pressure. And, since frequent gastritis and heartburn can be signs of more serious issues, including heart disease, don’t rely on this remedy more than once in a while. If you are having regular digestive difficulties, see your doctor.
As an underarm deodorant. You can pat a bit of baking soda onto each armpit after a morning shower, just like an old-fashioned dusting powder. While this won’t stop you from sweating, it will diminish the unpleasant odor. Not only is this far less expensive than commercial deodorants, it’s also perfectly safe. Antiperspirants actually plug the sweat glands, and some people think this may cause cancer. (See Daily Health News, April 15, 2010, “The Antiperspirant-Cancer Connection.”) Along the same lines, you also can use baking soda as a foot deodorant — just sprinkle a bit on your feet or in your shoes.
As an exfoliant. Baking soda is a gentle and effective exfoliant that almost all skin types can tolerate and only rarely causes an allergic reaction — it’s a good way to clean and open pores, diminishing whiteheads and clearing oily skin.To remove dead cells on the outer layer of skin, splash some water on your face… put some baking soda into the palm of your hand… and gently rub on the baking soda, using circular motions. Rinse.
And a final tip — baking soda is baking soda, so you can save money by purchasing a store brand instead of the better-known national ones. Not that they’re expensive either, but now that you know about all these nifty uses, you just might find that you’re going through a lot more baking soda than before.
Source(s):
Vicki Lansky, author of more than two dozen books on parenting and household management, lives in Minnetonka, Minnesota. Her Web site is www.PracticalParenting.com or go to www.BookPeddlers.com/BP.BSoda.html for more information on her book on baking soda.
Puzzles that required computer solutions
Wednesday, October 20th, 2010Long-time Dr . Dobb’s readers may remember
“Dr. Ecco’s Omniheurist Corner”
where Professor Dennis Shasha posed
puzzles that required computer solutions.
Dennis is returning to Dr. Dobb’s, but with
a new twist on puzzles. The idea is to take
inspiration from the challenging apps that
readers have faced and to turn those into
puzzles.
If you have written an application that
required extensive use of heuristics
(because no algorithm would solve it) or
that is otherwise algorithmically interesting,
please send mail to Dennis at
shasha@cs.nyu.edu. Put “Tough Apps” in the
subject line. If Dennis likes it, he will contact
you. Then he will try to understand what you’ve
done and create a puzzle explaining the algorithmic
core. You will write a little blurb about yourself
and the problem if you want.
An empty hotel room represents a lost opportunity
to the hotel owner. The marginal cost of
cleaning a room is minimal compared to the fixed
cost of the personnel, rent, and so on. So, the
hotel has every interest in filling all its rooms.
Clever travellers and entrepreneurs can take
advantage of this by waiting until the last minute
to buy cheap rooms. Of course, they run the risk
that they may not sleep anywhere. The result is a
game. Let’s work up to the game in stages. It will
lead us to strange and amoral places, I promise.
Suppose you have the only hotel
in town. You have three rooms free for tonight.
You know from history that there will be one visitor
who is willing to spend $300 per night,
another at $200 per night, and one at $100 per
night. We’ll abbreviate this demand profile to 1 @
$300, 1 @ $200, 1 @ $100. If you have to give the
same price to all comers, what should you set
your price to be?
$200 — you get
$400 and leave one room empty. A recurrent
theme in this puzzle is that charging the same
price to everyone in the service of fairness results
in empty hotel rooms and roomless travellers.
Suppose there are two hotels next to one
another of the same quality and the demand is
twice that before, i.e. 2 @ $300, 2 @ $200, 2 @
$100. Now if your hotel sets the price at $200, the
other hotel can set the price at, say, $180 and get
three guests out of the four. You get only $200.
If you don’t know how much the
other hotel will charge, then what can you guarantee
to obtain?
Solution to Warm-Up 2: If your hotel charges
$133 and the other charges more, then you will
fill your three rooms and get $399. On the other
hand, if the other hotel also charges less but more
than $100, then you will get only $133. So, if you
charge $100, you will guarantee an income of
$300. If the other hotel reasons the same way,
then there will be six rooms for six travellers,
each costing $100 per night. Note how much better
this is for consumers.
Warm-Up 3: The hotel owners approach anagent to set room prices for both of them. They
agree to give the agent a portion of any extra profit they would
make beyond the $300 they can already get.
Solution to Warm-Up 3: If the agent sets prices at $200 per
room instead of $100, then each hotel’s profits will increase to
$400 (less the agent’s commission) while leaving two travelers
without rooms. This is why a single agent (whether online or not)
can be as bad for consumers as a hotel monopoly.
Now It’s Your Turn
1. Suppose you have the only hotel in town and it has six rooms.
The general problem is, given a demand profile and a certain number
of rooms, try to find the price per room that will maximize
hotel profits if you control all the rooms in a town. If the demand
profile is x @ $300, y @ $200, and z @ $100, for which positive
values of x, y, and z would you set the price for your six rooms at
$300, for which positive values would you set the price at $200,
and for which at $100?
2. If you control all the rooms in town, is there ever any profitmaximization
reason to charge $250, given the above demand profile?
Why or why not?
3. Suppose there are two virtually identical hotels on the same
block each having three rooms, but you control the rooms of only
one and the demand profile is again x @ $300, y @ $200, and z @
$100. For which x, y, and z values would you charge $200 to guarantee
as much revenue as possible? For which x, y, z would you
charge $300?
4. Staying in the two hotel scenario, for which x, y, z would you
charge something strictly between $200 and $300 in your hotel
(assuming you don’t know what the other hotel charges)? What if
you did know the other hotel’s prices and customers would always
compare prices before taking a room?
5. Loyalty programs and other perks may direct customers your
way. Suppose that your perks program can convince all travelers to
come to your hotel first. Each traveler will take a room in your
hotel if you charge what he or she is willing to pay. As usual, there
are six travelers altogether, where x travelers will be willing to pay
$300, y @ $200, and z @ $100. How should you set your prices as
a function of x, y, and z? How should your competitor set prices?
6. As you can see, the pricing power of the hotel owner depends as
much on consumer behavior (whether consumers compare prices)
as on monopoly power, either gained directly or through an agent.
Do you see any general pattern?
Solutions
1. If x >= 3 and y <= 4, then setting the price at $300 is best for the
hotels, though only x people will get rooms. Otherwise, if x + y >=
3, then charge $200 to get $800 for the two hotels. Otherwise, set
the hotel prices to $100.
2. No. You capture no more customers than if you set the price to
$300 and receive less revenue.
3. We already saw in the Warm-Ups that you would charge $100 if
x = y = z = 2 to guarantee at least $300 in revenue. Any other price
would give a lesser guarantee (though the possibility of more). If x
>= 5, then each hotel may as well charge $300 as each will get at
least two customers at that price. If x <= 4 and x + y >= 5, then
$200 is the best price (because charging $300 would guarantee you
only one customer and charging $200 gurantees at least two).
4. There are no x, y, z for which it is worthwhile to charge something
between $200 and $300 unless you know the prices of the
other. If, on the other hand, you knew the other hotel was charging
$300 and x = 3 and y = 5, then you could charge say $280 and
get all the $300 customers.
5. If x >= 3, then a price of $300 will guaranteee $900. If x + y >=
2, then $200 will guarantee $600. Your competitor can’t charge
even $200 unless x + y >= 5.
6. With monopoly power, you know all customers will come to
you, so you can set the price through direct calculation. In a competitive
market, you have to assume the worst case. If you can convince
customers to come to you first, then you can charge the most
per room.