Android NULL Pointers (why can't people on StackOverflow read a StackTrace)

95% of the Android questions on StackOverflow can be solved by:

1.  running Logcat (adb logcat)
2.  Looking for NullPointerException (which points to the line in your code with issue).

It is amazing to me how many people actually put their logcat output into the question, when the NullPointer is so obvious.  It seems so basic to me.

"Droid Of The Day" Available Now in Android Market

I published my first official Android app to the market this morning.  Please download it, try it out, and give me good reviews ;-). The concept is simple:  It is an App recommendation engine that will notify you of a cool new apps available for the Google Android platform once a day.  I hope this will be a good way for people to discover cool new things they might not know about otherwise.  It is free, and I don't take money for sponsored apps, or do any other marketing.

You can search for it in the market, or here is the QR code (if you don't know what this is, simply start a barcode reader app on your phone, point it to this, and the rest will happen magically):

Here is a simple screen-shot, so you know what it looks like:

Manually updating Nexus One (for multitouch update)

As an early adopter, I find it hard to wait for Google to pick me, to push out the Over the Air (OTA) update for the Nexus One.   I found a quick and easy way to update the phone, with some super simple steps.  I found these directions at http://mobile-news.tungtram.com/2010/02/why-wait-for-nexus-one-android-ota.html , and I think he originally found them at: Android Forums. I previously used a similair procedure to update my G1, with minimal risk, and success.

I have used these steps, and verified they work.

The process is quick an easy, just follow the directions.

  1. Grab the update from Google: here.
  2. Move the zip file to your sd card, and rename it: update.zip
  3. Boot your device (holding down the trackball and power button at the same time)
  4. Go to bootloader > recovery
  5. When you see the image of the droid with triangle, press the power button and volume up
  6. Select: Apply sdcard:update.zip
  7. Wowza, your phone should be updating
  8. Select Reboot
  9. Wait patiently, and you will be rewarded with multi-touch goodness (and hopefully a better 3G radio).

If something goes wrong, simply restart the phone (the normal way - don't do any of the special key presses) to restart your phone without the update.

Of course, if you are worried about this sort of thing, just wait for the OTA update to be pushed to you, which is less risky.

Five Layer Mexican Dip

I made this for a football party (bummer, I won't need to make that again this season - I will be ready in a few months Cardinals - I still love you!).  It is very flavorful, and best of all, reasonably healthy.  Ellie Kreiger always has great recipes, and this one is no exception (all the flavors really mesh well together).  It can be made a day ahead, which should save a little time on game day.

Ingredients

  • 2 teaspoons olive oil
  • 1 medium onion, diced
  • 2 cloves garlic, minced
  • 1 (15.5-ounce) can black beans, preferably low-sodium, drained and rinsed
  • 1 tablespoon minced chipotle pepper in adobo
  • 4 tablespoons lime juice
  • 1/4 teaspoon ground cumin
  • 1 tablespoon water
  • 1/2 teaspoon salt
  • 2 cups corn kernels (10-ounce box frozen corn)
  • 1/4 cup chopped cilantro leaves
  • 2 ripe avocados
  • 4 medium tomatoes, seeded and diced (about 2 cups)
  • 1/4 cup thinly sliced scallion
  • 1 tablespoon finely diced jalapeno pepper, optional
  • 3/4 cup shredded extra-sharp Cheddar

Directions

Heat the oil in a skillet over medium-high heat. Add onions and cook until they soften, about 3 minutes. Stir in the garlic and cook for 2 minutes more.

Put half of the onion mixture into a food processor with the black beans, chipotle pepper, 2 tablespoons of the lime juice, cumin, water and salt. Puree until smooth. Set aside.

Add the corn to the skillet with the remaining onion mixture and cook for about 3 minutes. Remove from the heat and stir in the cilantro leaves.

In a small bowl mash the avocado with the remaining lime juice. In a medium bowl toss together the tomatoes, scallion and jalapeno, if using. Season tomato mixture with salt and pepper, to taste.

Spread the black bean dip into the bottom of an 8 by 8 glass baking or serving dish. Top with the corn mixture, spreading it out to form a single layer over the beans, repeat with the avocado, then the tomatoes. Top with cheese. Serve with baked chips.

Per Serving:

Calories 140; Total Fat 8 g; (Sat Fat 2 g, Mono Fat 3 g, Poly Fat 0.7 g) ; Protein 5g; Carb 16 g; Fiber 5g; Cholesterol 6mg; Sodium 245 mg

Bittersweet Chocolate Pudding Pie with Crème Fraîche Topping

This pie gets requested over and over from my wife for her birthday (and any potluck, Wednesday, etc).  It is a really balanced recipe with great flavors.  It was the "Desert of the Year in Bon Apetitie" and is a crowd pleaser.

An intense dark-chocolate filling topped with sweet-tangy cream.

Ingredients

Crust:

  • 1 cup chocolate wafer cookie crumbs (about half of one 9-ounce package; about 23 cookies, finely ground in processor)
  • 2 tablespoons sugar
  • 5 tablespoons unsalted butter, melted
  • 2 ounces bittersweet chocolate (60% cacao), finely chopped

Filling:

  • 1/3 cup sugar
  • 1/3 cup unsweetened cocoa powder
  • 2 tablespoons cornstarch
  • 1/8 teaspoon salt
  • 1 3/4 cups whole milk, divided
  • 1/4 cup heavy whipping cream
  • 4 ounces bittersweet chocolate (60% cacao), finely chopped
  • 1 tablespoon dark rum
  • 1 teaspoon vanilla extract

Topping:

  • 1 cup chilled crème fraîche*
  • 1 cup chilled heavy whipping cream
  • 1/4 cup sugar
  • 1 teaspoon vanilla extract
  • Bittersweet chocolate shavings or curls (optional)

Preparation

Crust: Position rack in center of oven; preheat to 350°F. Blend cookie crumbs and sugar in processor. Add melted butter; process until crumbs are evenly moistened. Press crumb mixture onto bottom and up sides (not rim) of 9-inch-diameter glass pie dish. Bake until crust begins to set and no longer looks moist, pressing gently with back of fork if crust puffs, about 12 minutes. Remove crust from oven, then sprinkle chopped chocolate over bottom of crust. Let stand until chocolate softens, 1 to 2 minutes. Using offset spatula or small rubber spatula, spread chocolate over bottom and up sides of crust to cover. Chill crust until chocolate sets, about 30 minutes.

Filling: Whisk sugar, cocoa, cornstarch, and salt to blend in heavy medium saucepan. Gradually add 1/3 cup milk, whisking until smooth paste forms. Whisk in remaining milk, then 1/4 cup cream. Using flat-bottom wooden spoon or heatproof spatula, stir mixture constantly over medium heat, scraping bottom and sides of pan until pudding thickens and begins to bubble at edges, about 5 minutes. Add chocolate; stir until mixture is smooth. Remove from heat; stir in rum and vanilla. Pour hot pudding into crust and spread evenly. Cool 1 hour at room temperature. Cover with plastic wrap; chill overnight. DO AHEAD: Can be made 2 days ahead. Keep refrigerated.

Topping: Using electric mixer, beat crème fraîche, whipping cream, sugar, and vanilla in medium bowl just until stiff peaks form and mixture is thick enough to spread (do not overbeat or mixture may curdle). Spread topping decoratively over top of pie, swirling to create peaks, if desired. DO AHEAD: Pie can be made 6 hours ahead. Cover with cake dome and refrigerate.

Sprinkle chocolate shavings decoratively atop pie, if desired. Cut pie into wedges and serve.

Here is a slice of the pie:

* Sold at some supermarkets and at specialty foods stores.

Best Beef Stew

Best Beef Stew

This recipe is from America's Test Kitchen, and is wonderful.  It takes a bit of time to put together, but is very easy if you follow the directions (and is worth it!)

Serves 6 to 8.   Published January 1, 2010.   From Cook's Illustrated.

Use a good-quality, medium-bodied wine, such as Côtes du Rhône or Pinot Noir, for this stew. Try to find beef that is well marbled with white veins of fat. Meat that is too lean will come out slightly dry. Four pounds of blade steaks, trimmed of gristle and silver skin, can be substituted for the chuck-eye roast. While the blade steak will yield slightly thinner pieces after trimming, it should still be cut into 11/2-inch pieces. Look for salt pork that is roughly 75 percent lean. The stew can be cooled, covered tightly, and refrigerated for up to 2 days. Reheat it gently before serving.

Ingredients

2 medium garlic cloves , minced or pressed through garlic press (about 2 teaspoons)
4 anchovy fillets , finely minced (about 2 teaspoons)
1 tablespoon tomato paste
1 boneless beef chuck-eye roast (about 4 pounds), trimmed of excess fat, cut into 1 1/2-inch pieces (see note and step by step below)
2 tablespoons vegetable oil
1 large onion , halved and cut from pole to pole into 1/8-inch-thick slices (about 2 cups)
4 medium carrots , peeled and cut into 1-inch pieces (about 2 cups)
1/4 cup unbleached all-purpose flour
2 cups red wine (see note)
2 cups low-sodium chicken broth
2 bay leaves
4 sprigs fresh thyme
4 ounces salt pork , rinsed of excess salt (see note)
1 pound Yukon gold potatoes , scrubbed and cut into 1-inch pieces
1 1/2 cups frozen pearl onions , thawed
2 teaspoons unflavored powdered gelatin (about 1 packet)
1/2 cup water
1 cup frozen peas , thawed
Table salt and ground black pepper

Instructions

1. Adjust oven rack to lower-middle position and heat oven to 300 degrees. combine garlic and anchovies in small bowl; press with back of fork to form paste. Stir in tomato paste and set mixture aside.

2. Pat meat dry with paper towels. Do not season. Heat 1 tablespoon vegetable oil in large heavy-bottomed Dutch oven over high heat until just starting to smoke. Add half of beef and cook until well browned on all sides, about 8 minutes total, reducing heat if oil begins to smoke or fond begins to burn. Transfer beef to large plate. Repeat with remaining beef and 1 tablespoon vegetable oil, leaving second batch of meat in pot after browning.

3. Reduce heat to medium and return first batch of beef to pot. Add onion and carrots to Dutch oven and stir to combine with beef. Cook, scraping bottom of pan to loosen any browned bits, until onion is softened, 1 to 2 minutes. Add garlic mixture and cook, stirring constantly, until fragrant, about 30 seconds. Add flour and cook, stirring constantly, until no dry flour remains, about 30 seconds.

4. Slowly add wine, scraping bottom of pan to loosen any browned bits. Increase heat to high and allow wine to simmer until thickened and slightly reduced, about 2 minutes. Stir in broth, bay leaves, thyme, and salt pork. Bring to simmer, cover, transfer to oven, and cook for 11/2 hours.

5. Remove pot from oven; remove and discard bay leaves and salt pork. Stir in potatoes, cover, return to oven, and cook until potatoes are almost tender, about 45 minutes.

6. Using large spoon, skim any excess fat from surface of stew. Stir in pearl onions; cook over medium heat until potatoes and onions are cooked through and meat offers little resistance when poked with fork (meat should not be falling apart), about 15 minutes. Meanwhile, sprinkle gelatin over water in small bowl and allow to soften for 5 minutes.

7. Increase heat to high, stir in softened gelatin mixture and peas; simmer until gelatin is fully dissolved and stew is thickened, about 3 minutes. Season with salt and pepper to taste; serve.

Ginger Molasses Cookies

Just in time for the holidays, a great recipe for some soft, spicy cookies. Ginger Molasses Cookies

Makes about 2 dozen cookies

Wet ingredients: 1 cups sugar 3/4 cups (1.5 sticks) unsalted butter 1/4 cup molasses 1 eggs

Dry ingredients: 2 cups all-purpose flour 1/2 t. baking soda 1/4 to 1/2 t. salt 11/4 t. cinnamon 1/2 t. ginger 1/8 t. nutmeg

Pre-heat oven to 350 degrees. In large mixing bowl, beat sugar and butter until light and fluffy.  Add molasses and eggs; beat well.

Whisk dry ingredients in separate bowl to combine.  Add flour mixture to butter mixture in two batches. Mix well until incorporated.

Form dough into walnut-sized balls (or use a small cookie scooper) and arrange onto cookie sheets lined with parchment paper or silpat.

Bake at 350 for 8 to 10 minutes or until edges just begin to brown. Cool 1 minute; remove from cookie sheets. Cool on wire racks.

Ginger Molasses Cookies