Thursday, June 9, 2011

Bit Of Creativeness

CHANGE THE APPEARANCE OF WINDOWS 7


I think every day you seen the same old theme on the desktop  about  years by only changing the wall papers. This is the solution for that. 100% working.Its the time.


Step 1
  •    Download universal theme patcher 
  • Choose the corresponding patcher based on you Windows/ For 32bit(x86):   UniversalThemePatcher-x86.exe  / For 64bit(amd64): UniversalThemePatcher-x64.exe
  • Patch all 3 and restart your pc.
Step 2


Download any one from the bellow

These are three different themes that you can download.How ever prefer 1st one as your theme.
Step 3
Then extract the rar file.You can do it by using win rar or by using  7 zip . In some themes you have to use 7 zip.
Step 4
Then go to the theme folder. In there you can find one folder and a theme file(.theme).They  should be in same name.Or it can be in your direct extract folder.As a example basic black folder and basic black (.theme) file
Step 5
Copy and paste them both in folder   (C:) > Windows > Resources >Themes 
Step 6
Finally close that folder and then right click on desk top select personalize go to installed themes select the particular theme and enjoy.  


MAKE YOUR FB/SKYPE CHAT MORE INTERACTIVE


When you goes through the face book and skype chat you may get a idea to do something creative.So this is the way how to do it now.

Download cool smiley arts

Click for
Only you have to do is just download those softwares.No need to install.Quick run.

  • You can create any type of art work by using this key pad.Click the radio button of the icon that you like to use and draw a art in the blue squares in the middle.
  • Finally select copy to clipboard button on the top.Then go to your chat box right click and paste it or click ctrl+v
Enjoy well.

Smiley arts Creation by Samitha Prasad Herath 

Wednesday, June 8, 2011

Python Code Collector

1. STATISTICS 


# Code to calculate the average of  number list   

def avg(numbers):
    sum=0
    for i in numbers:
        sum=sum+i
    n=len(numbers)
    avg=sum/n
    return (avg)


# Code to calculate the maximum of number list
def max(numbers):
    x=numbers[0]
    for i in numbers:
        if i>x:
            x=i
    return(x)

#Code to calculate the frequency of a number
def frequency(numbers,value):
    x=0
    for i in numbers:
        if i==value:
            x=x+1
    return(x)


#Code to find median of a list

def median(lis):
    lists=sorted(lis)
    n=len(lists)
    if n%2!=0:
        x=n//2
        return(lists[x])
    else:
        x=(n+1)//2
        y=(n+1)//2-1
        return(lists[y],lists[x])




def sort(list):
# Sorted to a new list
    sorted=[]
    while len(list)>0:
        min=list[0]
        for i in list:
            if i<min:
                min=i
        sorted.append(min)
        list.remove(min)
    return sorted


def sort2(lists):
#Sort in the same list
    a=0
    min=lists[a] 
    for i in range(a,len(lists)-1):
        if i<min:
            min=lists[i]
    lists.remove(min)
    lists.insert(a,min)
    a=a+1


    return lists




2. MATRICES



def determin(A):
#determinant of a matrix
    D=0
    i=0
    while i<len(A[0]):
        if len(A[0])==2:
            D=A[0][0]*A[1][1]-A[1][0]*A[0][1]
            break
        else:
            B=reduced(A,0,i)
            D=D+A[0][i]*((-1)**(i+1))*determin(B)
            i+=1
    return D




def reduced(A,k,i):
#reduces the matrix by removing the row k and column i
    B=[]
    n=0
    for p in range(len(A)):
        newrow=[]
        for q in range(len(A)):
            if p==k or q==i:
                n=n+1
            else:
                newrow.append(A[p][q])
    
        B.append(newrow)
    del B[k]
    return B




def trans(A):
#transpose of a matrix method 1
    def trans(m1):
    r=len(m1)
    c=len(m1[0])
    tran= [ r*[0] for i in range(c) ]
    
    for k in range(r):
        for j in range(c):
            tran[j][k]=m1[k][j]


    return(tran)



def transpose(B):
#transpose of a matrix method 2
    result=[]
    c=0
    l=len(B[0])
    while l>0:
        vec=[]
        for row in B:
            vec.append(row[c])
        c=c+1
        l=l-1
        result.append(vec)
    return result

                
                    
                
def inver(A):
#inverse of a matrix
    if determin(A)!=0:
        B=[]
        for i in range(len(A)):
            newline=[]
            for k in range(len(A[0])):
                newline.append(((-1)**(k+i+1))*determin(reduced(A,i,k))/determin(A))
            B.append(newline)
        C=trans(B)
        return C
            
    else:
        print('this matrix is singular')


def multmat(A,B):
#matrix product
    nrowsA=len(A)
    ncolsA=len(A[0])
    nrowsB=len(B)
    ncolsB=len(B[0])
    mat=[]
    row=[]
    ele=0
    for i in range(0,nrowsA,1):
        row=[]
        for k in range(0,ncolsB,1):
            ele=0
            for j in range(0,ncolsA,1):
                ele=ele+A[i][j]*B[j][k]
            row.append(ele)
        mat.append(row)
    return mat
    
def addmat(A,B):
#matrix addition
    nrows=len(A)
    ncol=len(A[0])
    addmat=[]
    for i in range(0,nrows,1):
        addrow=[]
        for k in range(0,ncol,1):
            addrow.append(A[i][k]+B[i][k])
        addmat.append(addrow)
    return addmat


3.ADDRESS BOOK



def add_contact(contact,name,tag,number):
#To add a contact to a dictionary 
  
    if name in contact:
        contact[name][tag]=number
    else:
        contact[name]={tag:number}




def del_contact(contact,name,tag=None):
#To delete a contact from the dictionary 
    if name in contact:
        if tag!=None:
            if tag in contact[name]:
                del(contact[name][tag])
            else:
                print('not found')
        else:
            del(contact[name])


    else:
        print('not found')




def print_contact(contact,name,tag=None):
#To print a contact from the dictionary
    if name in contact:
        if tag!=None:
            if tag in contact[name]:
                print(contact[name][tag])
            else:
                print('not found')
        else:
            print(contact[name])


    else:
        print('not found')



def find_contact(contac,name):
#To find a contact from the dictionary
    x=False
    for  i in contact:
        if name in i:
            print(i,contact[i])
            x=True
    if x==False:
        print ('not found')


4. UTILITIES 



fo=open('c:/Python31/phone numbers')


def list_to_phone_book(file):
#To convert list to a dictionary
    phone_book={}
    for l in file.readlines():
        name,number=l.split()
        phone_book[name]=number


    return(phone_book)                    
    file.close() 





f=open('c:/Python31/phone book')


def load_contacts(file):
#To load contacts from a file to dictionary
    phone_book={}
    for l in file.readlines():
        name,tag,number=l.split()
        if name in phone_book:
            phone_book[name][tag]=number
        else:
            phone_book[name]={tag:number}


    return(phone_book)                    
    file.close()