Chicken with Garlic, Basil, and Parsley

Chicken with Garlic, Basil, and Parsley Recipe
Recipe by KITTY731  "VERY easy! Baked chicken seasoned with garlic, parsley, basil, tomato, and red pepper flakes. Simple dinner."
Ingredients Makes servings US Metric Adjust Recipe (Help) 1 tablespoon dried parsley, divided 1 tablespoon dried basil, divided 4 skinless, boneless chicken breast halves 4 cloves garlic, thinly sliced 1/2 teaspoon salt 1/2 teaspoon crushed red pepper flakes 2 tomatoes, sliced

Directions

  1. Preheat oven to 350 degrees F (175 degrees C). Coat a 9×13 inch baking dish with cooking spray.
  2. Sprinkle 1 teaspoon parsley and 1 teaspoon basil evenly over the bottom of the baking dish. Arrange chicken breast halves in the dish, and sprinkle evenly with garlic slices. In a small bowl, mix the remaining 2 teaspoons parsley, remaining 2 teaspoons basil, salt, and red pepper; sprinkle over the chicken. Top with tomato slices.
  3. Bake covered in the preheated oven 25 minutes. Remove cover, and continue baking 15 minutes, or until chicken juices run clear.
  • PREP 10 mins
  • COOK 40 mins
  • READY IN 50 mins
Source : allrecipes[dot]com

Quick and Easy Mexican Chicken

Quick and Easy Mexican Chicken Recipe
Recipe by Karen Taylor  "An easy entree with Mexican flair! Serve over rice or buttered noodles."
Ingredients Makes servings US Metric Adjust Recipe (Help) 4 skinless, boneless chicken breasts cooking spray 1 clove garlic, minced 1 pinch salt 1 pinch ground black pepper 1 pinch ground cumin 1 cup salsa 1 cup shredded Cheddar cheese

Directions

  1. Preheat oven to 375 degrees F (190 degrees C).
  2. Heat a greased skillet to medium. Rub chicken pieces with garlic, salt, pepper and cumin to taste; place in hot skillet. Cook until brown on both sides and no longer pink, 10 to 15 minutes.
  3. Transfer chicken to 9×13-inch baking dish or casserole dish, top with salsa and cheese, and bake in preheated oven until cheese is bubbly and starts to brown, 15 to 20 minutes.
  • PREP 15 mins
  • COOK 25 mins
  • READY IN 40 mins
Source : allrecipes[dot]com

Hot Chicken and Chips Retro

Hot Chicken and Chips Retro Recipe
This recipe has a nostalgic appeal that harks back to the 1950s and ’60s. If you make it ahead, don’t add the baked potato chips until it’s time to bake the casserole, or they’ll become soggy. Only you will be able to view, print, and edit this note. Get endless recipe ideas for this dinnertime staple, emailed weekly.
Yield: 6 servings

Ingredients

  • 4 cups chopped roasted skinless, boneless chicken breast (about 4 breasts)
  • 1/4 cup chopped green onions
  • 1/4 cup chopped red bell pepper
  • 2 tablespoons finely chopped fresh flat-leaf parsley
  • 1 (8-ounce) can sliced water chestnuts, drained and chopped
  • 1/2 cup low-fat mayonnaise
  • 1/4 cup reduced-fat sour cream
  • 2 tablespoons fresh lemon juice
  • 2 teaspoons Dijon mustard
  • 1/2 teaspoon salt
  • 1/2 teaspoon freshly ground black pepper
  • Cooking spray
  • 3/4 cup (3 ounces) shredded Swiss cheese
  • 3/4 cup crushed baked potato chips (about 2 ounces)

Preparation

  1. Preheat oven to 400°.
  2. Combine chicken and next 4 ingredients (through water chestnuts) in a large bowl; stir well. Combine low-fat mayonnaise and next 5 ingredients (through black pepper) in a small bowl, stirring with a whisk. Add mayonnaise mixture to chicken mixture; stir well to combine. Spoon chicken mixture into an 11 x 7-inch baking dish coated with cooking spray, and sprinkle with cheese. Top cheese evenly with chips. Bake at 400° for 13 minutes or until filling is bubbly and chips are golden.
Source : myrecipes[dot]com

10 Most Common Mistakes that Python Programmers Make

About Python

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive forRapid Application Development, as well as for use as a scripting or glue language to connect existing components or services. Python supports modules and packages, thereby encouraging program modularity and code reuse.

About this article

Python’s simple, easy-to-learn syntax can mislead Python developers – especially those who are newer to the language – into missing some of its subtleties and underestimating the power of the language.

With that in mind, this article presents a “top 10” list of somewhat subtle, harder-to-catch mistakes that can bite even the most advanced Python developer in the rear.

(Note: This article is intended for a more advanced audience than Common Mistakes of Python Programmers, which is geared more toward those who are newer to the language.)

Common Mistake #1: Misusing expressions as defaults for function arguments

Python allows you to specify that a function argument is optional by providing a default value for it. While this is a great feature of the language, it can lead to some confusion when the default value is mutable. For example, consider this Python function definition:

>>> def foo(bar=[]):        # bar is optional and defaults to [] if not specified
   bar.append(“baz”)    # but this line could be problematic, as we’ll see…
   return bar

A common mistake is to think that the optional argument will be set to the specified default expression each time the function is called without supplying a value for the optional argument. In the above code, for example, one might expect that calling foo() repeatedly (i.e., without specifying a bar argument) would always return ‘baz’, since the assumption would be that each timefoo() is called (without a bar argument specified) bar is set to [] (i.e., a new empty list).

But let’s look at what actually happens when you do this:

>>> foo()
[“baz”]
>>> foo()
[“baz”, “baz”]
>>> foo()
[“baz”, “baz”, “baz”]

Huh? Why did it keep appending the default value of “baz” to an existing list each time foo() was called, rather than creating a new list each time?

The answer is that the default value for a function argument is only evaluated once, at the time that the function is defined. Thus, the bar argument is initialized to its default (i.e., an empty list) only when foo() is first defined, but then calls to foo() (i.e., without a bar argument specified) will continue to use the same list to which bar was originally initialized.

FYI, a common workaround for this is as follows:

>>> def foo(bar=None):
   if bar is None:# or if not bar:
       bar = []
   bar.append(“baz”)
   return bar

>>> foo()
[“baz”]
>>> foo()
[“baz”]
>>> foo()
[“baz”]

Common Mistake #2: Using class variables incorrectly

Consider the following example:

>>> class A(object):
    x = 1

>>> class B(A):
    pass

>>> class C(A):
    pass

>>> print A.x, B.x, C.x
111

Makes sense.

>>> B.x = 2
>>> print A.x, B.x, C.x
121

Yup, again as expected.

>>> A.x = 3
>>> print A.x, B.x, C.x
323

What the $%#!&?? We only changed A.x. Why did C.x change too?

In Python, class variables are internally handled as dictionaries and follow what is often referred to as Method Resolution Order (MRO). So in the above code, since the attribute x is not found in class C, it will be looked up in its base classes (only A in the above example, although Python supports multiple inheritance). In other words, C doesn’t have its own x property, independent of A. Thus, references to C.x are in fact references to A.x.

Common Mistake #3: Specifying parameters incorrectly for an exception block

Suppose you have the following code:

>>> try:
    l = [“a”, “b”]
    int(l[2])
except ValueError, IndexError:  # To catch both exceptions, right?
    pass

Traceback (most recent call last):
 File “”, line 3, in
IndexError: list index out of range

The problem here is that the except statement does not take a list of exceptions specified in this manner. Rather, In Python 2.x, the syntax except Exception, e is used to bind the exception to the optional second parameter specified (in this case e), in order to make it available for further inspection. As a result, in the above code, the IndexError exception is not being caught by the except statement; rather, the exception instead ends up being bound to a parameter named IndexError.

The proper way to catch multiple exceptions in an except statement is to specify the first parameter as a tuplecontaining all exceptions to be caught. Also, for maximum portability, use the as keyword, since that syntax is supported by both Python 2 and Python 3:

>>> try:
    l = [“a”, “b”]
    int(l[2])
except (ValueError, IndexError) as e:  
    pass

>>>

Common Mistake #4: Misunderstanding Python scope rules

Python scope resolution is based on what is known as the LEGB rule, which is shorthand for Local, Enclosing,Global, Built-in. Seems straightforward enough, right? Well, actually, there are some subtleties to the way this works in Python. Consider the following:

>>> x = 10
>>> def foo():
    x += 1
    print x

>>> foo()
Traceback (most recent call last):
 File “”, line 1, in
 File “”, line 2, in foo
UnboundLocalError: local variable ‘x’ referenced before assignment

What’s the problem?

The above error occurs because, when you make an assignment to a variable in a scope, that variable is automatically considered by Python to be local to that scope and shadows any similarly named variable in any outer scope.

Many are thereby surprised to get an UnboundLocalError in previously working code when it is modified by adding an assignment statement somewhere in the body of a function. (You can read more about this here.)

It is particularly common for this to trip up developers when using lists. Consider the following example:

>>> lst = [1, 2, 3]
>>> def foo1():
    lst.append(5)   # This works ok…

>>> foo1()
>>> lst
[1, 2, 3, 5]

>>> lst = [1, 2, 3]
>>> def foo2():
    lst += [5]      # … but this bombs!

>>> foo2()
Traceback (most recent call last):
 File “”, line 1, in
 File “”, line 2, in foo
UnboundLocalError: local variable ‘lst’ referenced before assignment

Huh? Why did foo2 bomb while foo1 ran fine?

The answer is the same as in the prior example, but is admittedly more subtle. foo1 is not making anassignment to lst, whereas foo2 is. Remembering that lst += [5] is really just shorthand for lst = lst + [5], we see that we are attempting to assign a value to lst (therefore presumed by Python to be in the local scope). However, the value we are looking to assign to lst is based on lst itself (again, now presumed to be in the local scope), which has not yet been defined. Boom.

Editor’s note: want posts just like this delivered straight to your inbox? Subscribe below to receive our latest engineering articles.

We will never share your email with any 3rd party or spam you

Common Mistake #5: Modifying a list while iterating over it

The problem with the following code should be fairly obvious:

>>> odd = lambda x : bool(x % 2)
>>> numbers = [n for n in range(10)]
>>> for i in range(len(numbers)):
    if odd(numbers[i]):
        del numbers[i]  # BAD: Deleting item from a list while iterating over it

Traceback (most recent call last):
   File “”, line 2, in
IndexError: list index out of range

Deleting an item from a list or array while iterating over it is a faux pas well known to any experienced software developer. But while the example above may be fairly obvious, even advanced developers can be unintentionally bitten by this in code that is much more complex.

Fortunately, Python incorporates a number of elegant programming paradigms which, when used properly, can result in significantly simplified and streamlined code. A side benefit of this is that simpler code is less likely to be bitten by the accidental-deletion-of-a-list-item-while-iterating-over-it bug. One such paradigm is that of list comprehensions. Moreover, list comprehensions are particularly useful for avoiding this specific problem, as shown by this alternate implementation of the above code which works perfectly:

>>> odd = lambda x : bool(x % 2)
>>> numbers = [n for n in range(10)]
>>> numbers[:] = [n for n in numbers ifnot odd(n)]  # ahh, the beauty of it all
>>> numbers
[0, 2, 4, 6, 8]

Common Mistake #6: Confusing how Python binds variables in closures

Considering the following example:

>>> def create_multipliers():
    return [lambda x : i * x for i in range(5)]
>>> for multiplier in create_multipliers():
    print multiplier(2)

You might expect the following output:

0
2
4
6
8

But you actually get:

8
8
8
8
8

Surprise!

This happens due to Python’s late binding behavior which says that the values of variables used in closures are looked up at the time the inner function is called. So in the above code, whenever any of the returned functions are called, the value of i is looked up in the surrounding scope at the time it is called (and by then, the loop has completed, so i has already been assigned its final value of 4).

The solution to this is a bit of a hack:

>>> def create_multipliers():
    return [lambda x, i=i : i * x for i in range(5)]

>>> for multiplier in create_multipliers():
    print multiplier(2)

0
2
4
6
8

Voilà! We are taking advantage of default arguments here to generate anonymous functions in order to achieve the desired behavior. Some would call this elegant. Some would call it subtle. Some hate it. But if you’re a Python developer, it’s important to understand in any case.

Common Mistake #7: Creating circular module dependencies

Let’s say you have two files, a.py and b.py, each of which imports the other, as follows:

In a.py:

import b

deff():
   return b.x

print f()

And in b.py:

import a

x = 1

defg():
   print a.f()

First, let’s try importing a.py:

>>> import a
1

Worked just fine. Perhaps that surprises you. After all, we do have a circular import here which presumably should be a problem, shouldn’t it?

The answer is that the mere presence of a circular import is not in and of itself a problem in Python. If a module has already been imported, Python is smart enough not to try to re-import it. However, depending on the point at which each module is attempting to access functions or variables defined in the other, you may indeed run into problems.

So returning to our example, when we imported a.py, it had no problem importing b.py, since b.py does not require anything from a.py to be defined at the time it is imported. The only reference in b.py to a is the call to a.f(). But that call is in g() and nothing in a.py or b.py invokes g(). So life is good.

But what happens if we attempt to import b.py (without having previously imported a.py, that is):

>>> import b
Traceback (most recent call last):
   File “”, line 1, in <module>
   File “b.py”, line 1, in <module>
   import a
   File “a.py”, line 6, in <module>
print f()
   File “a.py”, line 4, in f
return b.x
AttributeError: ‘module’ object has no attribute ‘x’

Uh-oh. That’s not good! The problem here is that, in the process of importing b.py, it attempts to import a.py, which in turn calls f(), which attempts to access b.x. But b.x has not yet been defined. Hence the AttributeError exception.

At least one solution to this is quite trivial. Simply modify b.py to import a.pywithing():

x = 1

defg():
   import a# This will be evaluated only when g() is called
   print a.f()

No when we import it, everything is fine:

>>> import b
>>> b.g()
1# Printed a first time since module ‘a‘ calls ‘print f()’ at the end
1# Printed a second time, this one is our call to‘g

Common Mistake #8: Name clashing with Python Standard Library modules

One of the beauties of Python is the wealth of library modules that it comes with “out of the box”. But as a result, if you’re not consciously avoiding it, it’s not that difficult to run into a name clash between the name of one of your modules and a module with the same name in the standard library that ships with Python (for example, you might have a module named email.py in your code, which would be in conflict with the standard library module of the same name).

This can lead to gnarly problems, such as importing another library which in turns tries to import the Python Standard Library version of a module but, since you have a module with the same name, the other package mistakenly imports your version instead of the one within the Python Standard Library. This is where bad stuff happens.

Care should therefore be exercised to avoid using the same names as those in the Python Standard Library modules. It’s way easier for you to change the name of a module within your package than it is to file a Python Enhancement Proposal (PEP) to request a name change upstream and to try and get that approved.

Common Mistake #9: Failing to address differences between Python 2 and Python 3

Consider the following file foo.py:

import sys

defbar(i):
   if i == 1:
       raise KeyError(1)
   if i == 2:
       raise ValueError(2)

defbad():
   e = None
   try:
       bar(int(sys.argv[1]))
   except KeyError as e:
       print(‘key error’)
   except ValueError as e:
       print(‘value error’)
   print(e)

bad()

On Python 2, this runs fine:

$ python foo.py 1
key error
1
$ python foo.py 2
value error
2

But now let’s give it a whirl on Python 3:

$ python3 foo.py 1
key error
Traceback (most recent call last):
 File “foo.py”, line19, in
   bad()
 File “foo.py”, line17, in bad
   print(e)
UnboundLocalError: localvariable‘e’ referenced before assignment

What has just happened here? The “problem” is that, in Python 3, the exception object is not accessible beyond the scope of the except block. (The reason for this is that, otherwise, it would keep a reference cycle with the stack frame in memory until the garbage collector runs and purges the references from memory. More technical detail about this is available here).

One way to avoid this issue is to maintain a reference to the exception object outside the scope of the exceptblock so that it remains accessible. Here’s a version of the previous example that uses this technique, thereby yielding code that is both Python 2 and Python 3 friendly:

import sys

defbar(i):
   if i == 1:
       raise KeyError(1)
   if i == 2:
       raise ValueError(2)

defgood():
   exception = None
   try:
       bar(int(sys.argv[1]))
   except KeyError as e:
       exception = e
       print(‘key error’)
   except ValueError as e:
       exception = e
       print(‘value error’)
   print(exception)

good()

Running this on Py3k:

$ python3 foo.py 1
keyerror
1
$ python3 foo.py 2
value error
2

Yippee!

(Incidentally, our Python Hiring Guide discusses a number of other important differences to be aware of when migrating code from Python 2 to Python 3.)

Common Mistake #10: Misusing the __del__ method

Let’s say you had this in a file called mod.py:

import foo

classBar(object):
      …
   def__del__(self):
       foo.cleanup(self.myhandle)

And you then tried to do this from another_mod.py:

import mod
mybar = mod.Bar()

You’d get an ugly AttributeError exception.

Why? Because, as reported here, when the interpreter shuts down, the module’s global variables are all set to None. As a result, in the above example, at the point that __del__ is invoked, the name foo has already been set to None.

A solution would be to use atexit.register() instead. That way, when your program is finished executing (when exiting normally, that is), your registered handlers are kicked off before the interpreter is shut down.

With that understanding, a fix for the above mod.py code might then look something like this:

import foo
import atexit

defcleanup(handle):
   foo.cleanup(handle)


classBar(object):
   def__init__(self):
       …
       atexit.register(cleanup, self.myhandle)

This implementation provides a clean and reliable way of calling any needed cleanup functionality upon normal program termination. Obviously, it’s up to foo.cleanup to decide what to do with the object bound to the name self.myhandle, but you get the idea.

Wrap-up

Python is a powerful and flexible language with many mechanisms and paradigms that can greatly improve productivity. As with any software tool or language, though, having a limited understanding or appreciation of its capabilities can sometimes be more of an impediment than a benefit, leaving one in the proverbial state of “knowing enough to be dangerous”.

Familiarizing oneself with the key nuances of Python, such as (but by no means limited to) the issues raised in this article, will help optimize use of the language while avoiding some of its more common pitfalls.

You might also want to check out our Insider’s Guide to Python Interviewing for suggestions on interview questions that can help identify Python experts.

Original : toptal.com

 

Google Enlists Major Shippers to Expand Delivery Service

ALISTAIR BARR

GoogleGOOGL -1.74% built a fleet of small blue and white vans to run its local commerce and delivery service Google Shopping Express in parts of San Francisco, New York and Los Angeles. But as it expands into less densely populated areas, Google is leaning on other shippers.

Google

Google Shopping Express said Tuesday it will expand its overnight-delivery service in coming months across northern California so that it will stretch from the Oregon border to Fresno, roughly 400 miles to the south.

Google said it is working with “major shipping carriers” to fulfill the orders, which can be placed by 7 pm for delivery the following day.

Google Shopping Express routes online and mobile orders to stores run by retailers including Target, Toys “R” Us, WalgreenWAG -0.62% and Whole Foods MarketWFM -0.13%. Store staff pick and pack the orders and Google handles the delivery to people’s homes.

In urban and suburban areas, where residents live closer together, it is efficient for Google to run its own delivery trucks because they can deliver multiple orders in the same trip. But in more rural areas, the economics get tougher, according to Tom Fallows, product management director for Google Shopping Express.

“In less dense areas, a partnership with other carriers makes more sense,” he said. Fallows declined to name the shipping companies and whether those costs will get passed on to shoppers, though he said Google is working with national and regional carriers. “We are very committed to making this an everyday affordable price point,” he said.

Google will keep using its own delivery vans as it brings the service to more cities, Fallows added.

Traditional e-commerce providers rely on shippers to deliver purchases to shoppers. “But with local stores there is no infrastructure yet,” Fallows said. “That’s why we’re doing this.”

Google hasn’t disclosed sales or order volumes for Google Shopping Express, and Fallows declined to comment on how the business is faring. But he said Google is committed to its delivery service. “Once you are dealing with tens of thousands or hundreds of thousands of orders per day, it makes sense to run it through your own system and network of delivery vehicles,” he said.

Google is competing with Amazon.comAMZN -0.53%, the world’s largest Internet retailer, which has grabbed some of Google’s lucrative product-search business in recent years. Google Shopping Express is a way for Google to try to take some of that business back.

Google started its service in urban areas with fast delivery from local stores, and now it is expanding more broadly. In contrast, Amazon started with a broad online-shopping service and is now focusing more on deliveries in urban areas.

Both companies appear to be coming to similar conclusions: When delivering orders in densely populated areas, it makes sense to have your own fleet. When deliveries are headed to less populated areas, it is better to rely on existing carriers.

– Correction: An earlier version of this post incorrectly attributed Fallows’ remarks to Brandon Trew, another Google executive.

Original : wsj.com

 

Roast Chicken Chimichangas

Roast Chicken Chimichangas Recipe
These chimichangas are oven-browned instead of deep-fried. The filling uses queso fresco. If it’s not available, try shredded Monterey Jack. Only you will be able to view, print, and edit this note. Get a quick and healthy dinner recipe delivered to your inbox each weekday.
Yield: 6 servings (serving size: 1 chimichanga and about 4 teaspoons salsa)

Ingredients

  • 2 1/2 cups shredded roasted skinless, boneless chicken breasts
  • 1 cup (4 ounces) crumbled queso fresco cheese
  • 1/4 cup chopped green onions
  • 1 teaspoon dried oregano
  • 1/4 teaspoon ground cumin
  • 1 garlic clove, minced
  • 1 (4.5-ounce) can chopped green chiles, drained
  • 1 (16-ounce) can fat-free refried beans
  • 6 (8-inch) flour tortillas
  • Cooking spray
  • 1/2 cup bottled green salsa

Preparation

  1. Preheat oven to 500°.
  2. Combine first 7 ingredients in a large bowl; toss well.
  3. Spread 1/4 cup beans down center of each tortilla. Top each tortilla with 2/3 cup chicken mixture; roll up. Place rolls, seam sides down, on a large baking sheet coated with cooking spray. Coat tops of chimichangas with cooking spray. Bake at 500° for 7 minutes. Serve with salsa.
Source : myrecipes[dot]com

Potato, Chicken, and Fresh Pea Salad

Potato, Chicken, and Fresh Pea Salad Recipe
Fast: Serve warm, at room temperature, or chilled for maximum versatility. Leftovers make an easy and satisfying lunch. Only you will be able to view, print, and edit this note. Get endless recipe ideas for this dinnertime staple, emailed weekly.
Yield: 4 servings (serving size: about 1 1/2 cups)

Ingredients

  • 1 pound fingerling potatoes, cut crosswise into 1-inch pieces
  • 2 cups fresh sugar snap peas
  • 2 cups chopped skinless, boneless rotisserie chicken breast
  • 1/2 cup finely chopped red bell pepper
  • 1/2 cup finely chopped red onion
  • 2 tablespoons extra-virgin olive oil
  • 2 tablespoons white wine vinegar
  • 1 tablespoon fresh lemon juice
  • 1 tablespoon Dijon mustard
  • 1 teaspoon minced fresh tarragon
  • 1 teaspoon salt
  • 1/2 teaspoon freshly ground black pepper
  • 1 garlic clove, minced

Preparation

  1. 1. Place potatoes in a large saucepan; cover with cold water. Bring to a boil. Reduce heat, and simmer 10 minutes or until almost tender. Add peas; cook 2 minutes or until peas are crisp-tender. Drain; place vegetables in a large bowl. Add chicken, bell pepper, and onion.
  2. 2. Combine oil and remaining ingredients, stirring with a whisk. Drizzle over salad; toss gently to combine.
Source : myrecipes[dot]com