What’s normal?

cool-normal-Morticia-Addams-quote

Advertisements

A little Python!

The programming language one, not the snake one!

Hello pals!
Some time ago, I came across a problem in which I had to flatten an array of objects. That is, the elements of the array can be primitives or arrays. The end results is to be an array of primitives.

I used python to implement this since it allows much more compact snippets for such jobs.

Here is the code 🙂

def flatten(lst):
 return sum( ([x] if not isinstance(x, list) else flatten(x)
 for x in lst), [] )
 
lst = [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []]
print flatten(lst)

Continue reading “A little Python!”

Android studio – some shortcuts

Hello guys!

A couple days ago I realized I could share some really useful shortcuts for Android studio, which is the official android development IDE.

Here is the first one:

Tab: applies the first suggestion in the ctrl+space helper menu

and:

inn , tab: inserts if (variable != null){   } block

also:

fbc, tab: inserts findViewById() block with casl.