Wednesday, April 2, 2014

list update

If you need to modify the sequence you are iterating over while inside the loop (for example to duplicate selected items), it is recommended that you first make a copy. Iterating over a sequence does not implicitly make a copy. The slice notation makes this especially convenient:

for w in words[:]:  # Loop over a slice copy of the entire list.
    if len(w) > 6:
        words.insert(0, w)

#words: ['defenestrate', 'cat', 'window', 'defenestrate']

Sunday, March 16, 2014

Dimension Unit Measurements Supported in Android

Pixels px
Actual screen pixels

Inches in
Physical measurement

Millimeters mm
Physical measurement

Points pt
Common font measurement unit

Screen density independent pixels dp
Pixels relative to 160dpi screen(Preferable for dimension screen compatibility)

Scale-independent pixels sp
Best for scalable font display

Friday, March 7, 2014

how to send a running program to backgroud in linux?

Type
Ctrl + Z && bg
then the program will run in background and you can't kill it by ctrl + C unless you use
fg
then the program will back to foreground.

If you want to run a program at the beginning, (you may want to use the same terminal while the programming is running), add & at the end.
./program &