How to install Android Eclipse Plugin and start coding immediately (Android Virtual Device Definition- Android SDK)

Hi, in this short tutorial, we are going to install Android Development Plugin (which is called ADT (Android Development Tools)) on Eclipse briefly.

First of all, to do that please download Eclipse from the following location;


2. When you start Eclipse choose


Copy and paste Work With location

and press add like this;


Click Next for downloading and accept license agreement. After the installation, you need to restart your eclipse in order to start programming Android apps.

3. You need to define the location of Android SDK Tools inside eclipse to start coding, for that reason, you need to download Software Development Kit including the main functionalities, libraries of Android, for doing that go to
under use existing IDE menu choose download the sdk tools for windows

4. After the download, click on the exe file choose a sdk installation location (we will use this location later inside eclipse)


Click next and on SDK Manager click install all (in my case 11 packages)

Please note SDK Path will be used inside Eclipse so it is better to note somewhere for me it is under C:\Users\tunato\AppData\Local\Android\android-sdk


This will take some time so be patient. Press close after all downloads are completed.

5. Before coding Android apps using Eclipse, you need to set the location of Android SDK on Eclipse for that;


inside SDK Location choose your sdk installation directory for me C:\Users\tunato\AppData\Local\Android\android-sdk

press apply and ok and now you are ready to code Android


6. For testing the android SDK installation, we will now  define a AVD which is called as Android Virtual Device and this device will use Android API

Click on Window > Android Virtual Device Manager or Android DM button on the left


Select the following values by setting AVD Name, Device, Target and CPU click ok and this will create our virtual Android Device and we will use this device for testing our apps


To test our configuration including SDK installation and AVD definition click on

File>New>Other and choose Android Sample Project
Select HellowEffects sample android project from list;


Click on Finish;

Right click on HelloEffects sample app


Click on Run as Android Application and this will open Android Virtual Device, (if it fails try to decrease AVD ram values by decreasing RAM values)

You have to be patient while the initialization of AVD. This will take some time for the first time,

On Android Virtual Device app menu  click on FX HelloEffects 


And after clicking you will see a screen like that so the application works!!


Emulator Console log will be similar to this one;

[2013-08-30 11:12:55 – SDK Manager] Updated AVD ‘AVDTEST’ based on Android 4.3, Intel Atom (x86) processor,
[2013-08-30 11:12:55 – SDK Manager] with the following hardware config:
[2013-08-30 11:12:55 – SDK Manager] hw.sdCard=no
[2013-08-30 11:12:55 – SDK Manager] hw.device.manufacturer=Google
[2013-08-30 11:12:55 – SDK Manager] hw.mainKeys=no
[2013-08-30 11:12:55 – SDK Manager] hw.lcd.density=320
[2013-08-30 11:12:55 – SDK Manager] hw.accelerometer=yes
[2013-08-30 11:12:55 – SDK Manager] hw.dPad=no
[2013-08-30 11:12:55 – SDK Manager] hw.device.hash=298918422
[2013-08-30 11:12:55 – SDK Manager] hw.trackBall=no
[2013-08-30 11:12:55 – SDK Manager] 4
[2013-08-30 11:12:55 – SDK Manager]
[2013-08-30 11:12:55 – SDK Manager] hw.sensors.proximity=yes
[2013-08-30 11:12:55 – SDK Manager] hw.battery=yes
[2013-08-30 11:12:55 – SDK Manager] disk.dataPartition.size=200M
[2013-08-30 11:12:55 – SDK Manager] hw.gpu.enabled=yes
[2013-08-30 11:12:55 – SDK Manager] hw.audioInput=yes
[2013-08-30 11:12:55 – SDK Manager] hw.sensors.orientation=yes
[2013-08-30 11:12:55 – SDK Manager]
[2013-08-30 11:12:55 – SDK Manager] hw.gps=yes
[2013-08-30 11:12:55 – SDK Manager] skin.dynamic=yes
[2013-08-30 11:12:55 – SDK Manager] hw.keyboard=yes
[2013-08-30 11:12:55 – SDK Manager] vm.heapSize=64
[2013-08-30 11:12:55 – SDK Manager] hw.ramSize=768
[2013-08-30 11:13:49 – HelloEffects] ——————————
[2013-08-30 11:13:49 – HelloEffects] Android Launch!
[2013-08-30 11:13:49 – HelloEffects] adb is running normally.
[2013-08-30 11:13:49 – HelloEffects] Performing activity launch
[2013-08-30 11:13:49 – HelloEffects] Automatic Target Mode: launching new emulator with compatible AVD ‘AVDTEST’
[2013-08-30 11:13:49 – HelloEffects] Launching a new emulator with Virtual Device ‘AVDTEST’
[2013-08-30 11:13:51 – Emulator] emulator: Failed to open the HAX device!
[2013-08-30 11:13:51 – Emulator] HAX is not working and emulator runs in emulation mode
[2013-08-30 11:13:51 – Emulator]
[2013-08-30 11:13:51 – Emulator] emulator: Open HAX device failed
[2013-08-30 11:13:51 – Emulator]
[2013-08-30 11:13:51 – Emulator] emulator: warning: opening audio input failed
[2013-08-30 11:13:51 – Emulator]
[2013-08-30 11:13:51 – Emulator] creating window 0 0 513 854
[2013-08-30 11:13:51 – HelloEffects] New emulator found: emulator-5554
[2013-08-30 11:13:51 – HelloEffects] Waiting for HOME (‘android.process.acore’) to be launched…
[2013-08-30 11:14:41 – HelloEffects] HOME is up on device ’emulator-5554′
[2013-08-30 11:14:41 – HelloEffects] Uploading HelloEffects.apk onto device ’emulator-5554′
[2013-08-30 11:14:42 – HelloEffects] Installing HelloEffects.apk…
[2013-08-30 11:15:13 – HelloEffects] Success!
[2013-08-30 11:15:13 – HelloEffects] Starting activity on device emulator-5554
[2013-08-30 11:19:04 – Emulator] Error accepting connection, aborting

So you can continue from now to develop your custom apps with this configuration!!


How to kill processes on Windows backend

taskkill command is what you looking for;

first try with tasklist after


Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
System 4 Services 0 984 K
smss.exe 428 Services 0 68 K
wininit.exe 656 Services 0 116 K
services.exe 720 Services 0 7,768 K
lsm.exe 792 Services 0 3,136 K
Excel.exe 892 Services 0 93,136 K

After learning the process name just apply the following command
/im stands for image name “*” wildcards are also supported
/f stands for forcing
/t terminates child processes as well

C:\Users\tunatore>taskkill /f /im Excel.exe /t

more details

taskkill /?

Python itertools example source code

Created on Aug 3, 2013

@author: tunatore

#python itertools examples
#Functions creating iterators for efficient looping
#refer to

from itertools import *

#counter starting from 1 to infinite 
for i in count(1):
    print (i, " ",  end="")
    if (i==15):
#1  2  3  4  5  6  7  8  9  10  11  12  13  14  15 
print ("\n")

#counter starting from 1 (increment with 5) to infinite
for i in count(1,5):
    print (i, " ",  end="")
    if (i>=50):
#1  6  11  16  21  26  31  36  41  46  51  

print ("\n")

c = cycle("TUNA")
for i in range(12):
    print (next(c), end="")


print ("\n")

for i in repeat('python', 4):
    print (i, end="")


print ("\n")
list1 = ['Test1','Goose','Bison','Pelican']
list2 = ['Cat','Dog','Elephant','Bird','Tiger','Lion','Rabbit']
print ([i for i in chain(list1,list2)],"\n")
#['Test1', 'Goose', 'Bison', 'Pelican', 'Cat', 'Dog', 'Elephant', 'Bird', 'Tiger', 'Lion', 'Rabbit']

print ([i for i in compress('TUNATORE', [1,1,1,1,False,False,False,0])],"\n")
#['T', 'U', 'N', 'A']
print ([i for i in compress('TUNATORE', [0,0,0,0,1,1,1,1])],"\n")
#['T', 'O', 'R', 'E']

#dropwhile (starts when prediction fails)
print ([i for i in dropwhile(lambda z: z>3, [9,5,6,7,2,1,4,5,6])],"\n")
#[2, 1, 4, 5, 6]

#takewhile (starts when as long as prediction true)
print ([i for i in takewhile(lambda z: z>6, [9,8,7,6,5,4,3,2,1])],"\n")
#[9, 8, 7]

#filterfalse (z>3 false items will return)
print ([i for i in filterfalse(lambda z: z>3, [9,5,6,7,2,1,4,5,6])],"\n")
#[2, 1]
#filterfalse (z>3 false items will return)
print ([i for i in filterfalse(lambda z: z<3, [9,5,6,7,2,1,4,5,6])],"\n")
#[9, 5, 6, 7, 4, 5, 6]

print([i for i in islice('tuna',2)],"\n")
#['t', 'u']
print([i for i in islice('tuna',2,3)],"\n")
print([i for i in islice('tuna',0,None)],"\n")
#['t', 'u', 'n', 'a']

print([i for i in zip_longest('tntr','uaoe',fillvalue='')],"\n")
#[('t', 'u'), ('n', 'a'), ('t', 'o'), ('r', 'e')]

#product for cartesian
print([i for i in product('tuna','tore')],"\n")
#[('t', 't'), ('t', 'o'), ('t', 'r'), ('t', 'e'), ('u', 't'), ('u', 'o'), ('u', 'r'), ('u', 'e'), ('n', 't'),
#('n', 'o'), ('n', 'r'), ('n', 'e'), ('a', 't'), ('a', 'o'), ('a', 'r'), ('a', 'e')]

print([i for i in permutations('tuna',4)],"\n")
#[('t', 'u', 'n', 'a'), ('t', 'u', 'a', 'n'), ('t', 'n', 'u', 'a'), ('t', 'n', 'a', 'u'), ('t', 'a', 'u', 'n'),
# ('t', 'a', 'n', 'u'), ('u', 't', 'n', 'a'), ('u', 't', 'a', 'n'), ('u', 'n', 't', 'a'), ('u', 'n', 'a', 't'),
#('u', 'a', 't', 'n'), ('u', 'a', 'n', 't'), ('n', 't', 'u', 'a'), ('n', 't', 'a', 'u'), ('n', 'u', 't', 'a'),
#('n', 'u', 'a', 't'), ('n', 'a', 't', 'u'), ('n', 'a', 'u', 't'), ('a', 't', 'u', 'n'), ('a', 't', 'n', 'u'),
#('a', 'u', 't', 'n'), ('a', 'u', 'n', 't'), ('a', 'n', 't', 'u'), ('a', 'n', 'u', 't')]

#useful itemgetter import
from operator import itemgetter

salesByDay =  [('20130101', 35), ('20130101', 25) ,('20130102', 35), ('20130101', 40), ('20130103', 66) ,('20130103', 66), ('20130102', 44)]

#keys have to be sorted
sortedSalesByDay = sorted(salesByDay, key=itemgetter(0))
for key, values in groupby(sortedSalesByDay, itemgetter(0)):
    print ("Day:",key)
    for value in values:
        print ("Value ",value[1])

# Day: 20130101
# Value  35
# Value  25
# Value  40
# Day: 20130102
# Value  35
# Value  44
# Day: 20130103
# Value  66
# Value  66

Python decorators example source code

Here you can find an example for Python Decorators
summary of content;

built-in decorators
usage of before and after decorator
modifying returning function

Created on Aug 2, 2013

@author: tunatore

#decorators are similar to Aspect Oriented Programming in JAVA 
#They have the ability to run after or before any function 
#decorators are applied with @character
#you can use built-in decorators such as @staticmethod

class Hello():
    def f():
        return "Hello"
print (Hello.f())

class HelloInstance():
    def f(self):
        return "Hello from Instance"

#the following won't work    
#print (HelloInstance.f())    
#you should try

hwi = HelloInstance()
print (hwi.f())

class User:
    """User class"""
    id = 1234567890
    name = "tuna"

#CHANINED decorators    
def trace(f):
    def newFunc(): #any def method name is allowed such as new,newFunc or wrapper ..
        print ("tracing..")
    return newFunc

def storelastlogin(f):
    def newFunc():
        print ("storing..")
    return newFunc

def login():    
    print ("user ID: " + str(User().id) + " name: " + User().name)


def beforeAndAfter(f):  
    def newFunc(): 
        print ("before.. is called")
        print ("after.. is called")
    return newFunc

def loginSecond():  
    pass #do nothing
def changeFunctionLogic(f):
    def newFunc(*args): #any def method name is allowed such as new,newFunc or wrapper ..
        print ("changing output by multiplying function itself")
        return f(*args) * f(*args) 
    return newFunc

def multiplyNumbers(arg1,arg2):
    return arg1 * arg2

print ("Result (2*2) * (2*2) =", multiplyNumbers(2, 2))


Hello from Instance
user ID: 1234567890 name: tuna
before.. is called
after.. is called
changing output by multiplying function itself
Result (2*2) * (2*2) = 16

Python getting user input and time usage

Created on Aug 1, 2013
Python version > 3
@author: tunatore
import time

#before python 3 please use raw_input() function instead
#refer to

#starting clock
startTime = time.clock()

stars = input('I will print stars tell me any number :')

#printing stars
for j in range(int(stars)+1):
    print ('*'*(j))

word = input('Tell me a word :')

#printing word
for j in range(int(len(word)+1)):
    print (word[j-1]*(j))

#stopping clock
stopTime = time.clock()

print ("You have been using this program for {0} seconds".format( stopTime - startTime))


I will print stars tell me any number :10

Tell me a word :tuna

You have been using this program for 4.22824467283872 seconds

Python lambda usage and simple example

Lambda Example Source Code

Created on Jul 31, 2013

@author: tuna

#lambdas are similar to functions in python with simple syntax
#do define a increment lambda 
#first function example below
def addNumbers(x,y):
    return x+y

print(addNumbers(2, 2))

#output 4
#same thing with short lambda syntax

l = lambda x,y : x+y

print "lambda output ", l(2,2)
#lambda output 4

#another example return abs value
l = lambda x : abs(x)

print "lambda abs output", l(-1999)
#lambda abs output 1999
print "lambda abs output", l(6)
#lambda abs output 6

#filtering list using lambda

numberList = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
#filtering numbers greater then 10
print (filter(lambda x: x>10, numberList))
#output [11, 12, 13, 14, 15]

#showing only even numbers
print (filter(lambda x: x%2==0, numberList))
#output [2, 4, 6, 8, 10, 12, 14]

#lambda different syntax
print (lambda x : abs(x))(-100)

#lambda different syntax
print (lambda x,y,z: x*y*z)(3, 4, 5)
#output 60

nameList = ["Tornado","Tuna","Bob"]
for name in nameList:
    print (lambda x: x.startswith('T'))(name)


lambda output 4
lambda abs output 1999
lambda abs output 6
[11, 12, 13, 14, 15]
[2, 4, 6, 8, 10, 12, 14]