Sunday, November 3, 2013

Python Data Types Code Example - පයිතන් දත්ත වර්ග

x = []
for i in range(0,10):
    x.append(i)
print x
print "______________________________________"

y = x * 10

x = "Hello World!"

print x
print "______________________________________"
print y

# What are X and Y?

===================================


#############
# Arithmetic
#############
4 + 4 == 8
3 - 5 == -2
16 / 2 == 8
16 * 4 == 64
3 % 2 == 1 # Modulus

# Long Int Conversion - Useful for function type mismatches - Not needed here.
100000000000000000000L + long(100) == 100000000000000000100L

======================

##########
# Strings
##########

a = "Hello"
b = "World!"

# Concatenation
a + " " + b == "Hello World!"

# Repetition and Concatenation
a * 3 + " " + b == "HelloHelloHello World!"
(a + " ") * 3 + b == "Hello Hello Hello World!"

# Indexing
b[2] == "r"

# Conversion of data to string - Sesame Street:
c = 7 # Backquote ` ` or str() operations
( a + " number " + `c` ) and ( a + " number " + str(c) ) == "Hello number 7"

Friday, November 1, 2013

ICT & Digital Media helps Kandy Youth to win the World Award



YES AYV Creative Youth Media Project implemented by Shilpa Sayura has won WSYA 2013 Award. YES AYV is a Sri Lankan platform that has trained more than 100 youngsters in digital media creation in order to make an impact in the local community with the help of creative digital art. YES AYV Creative Youth Media Project started in 2011 with UNHABITAT and Adobe Youth Voices support. They have trained more than 100 under-served youngsters in digital media creation, enabled collaboration, expression, dialog and digital journalism to report on issues related to them in pursuit of truth, made success in creation and publishing of digital media on interactive social platforms making them active participants in the public interest of their community, country and world. The think an effective use of media creation tools, Social Networks and Mobiles inspires youth to use digital journalism to inquire MDG related issues.

http://www.youthaward.org/winners/yes-ayv-creative-youth-media-project


The World Summit Youth Award (WSYA) is a unique global contest which brings together young developers and digital entrepreneurs under 30 years of age - who use internet and mobile technology to put the UN Millennium Development Goals (MDGs) into action and make a difference.

The WSYA selects and promotes best practice in e-Content. It demonstrates young people's potential to create outstanding digital contents and serves as a platform for people from all UN member states to work together in the efforts to reach the Millennium Development Goals (MDGs).

WSYA Award was given away at WSA Global Congress held in Sri Lanka.

Wednesday, October 9, 2013

Two's Complement Binary Addition

 -39 + 92 = 53:

1111
11011001
+01011100
00110101
Carryout without overflow. Sum is Correct.

104 + 45 = 149:
111
01101000
+00101101
10010101
Overflow, no carryout. Sum is not correct.

 10 + -3 = 7:
11111
00001010
+11111101
00000111
Carryout without overflow. Sum is correct.

-1 + 1 = 0:
11111111
11111111
+00000001
00000000
Carryout without overflow. Sum is correct.

Boolean Expression Simplification

  • Simplify: C + BC:
    ExpressionRule(s) Used
    C + BCOriginal Expression
    C + (B + C)DeMorgan's Law.
    (C + C) + BCommutative, Associative Laws.
    T + BComplement Law.
    TIdentity Law.
  • Simplify: AB(A + B)(B + B):
    ExpressionRule(s) Used
    AB(A + B)(B + B)Original Expression
    AB(A + B)Complement law, Identity law.
    (A + B)(A + B)DeMorgan's Law
    A + BBDistributive law. This step uses the fact that or distributes over and. It can look a bit strange since addition does not distribute over multiplication.
    AComplement, Identity.
  • Simplify: (A + C)(AD + AD) + AC + C:
    ExpressionRule(s) Used
    (A + C)(AD + AD) + AC + COriginal Expression
    (A + C)A(D + D) + AC + CDistributive.
    (A + C)A + AC + CComplement, Identity.
    A((A + C) + C) + CCommutative, Distributive.
    A(A + C) + CAssociative, Idempotent.
    AA + AC + CDistributive.
    A + (A + T)CIdempotent, Identity, Distributive.
    A + CIdentity, twice.
    You can also use distribution of or over and starting from A(A+C)+C to reach the same result by another route.
  • Simplify: A(A + B) + (B + AA)(A + B):
    ExpressionRule(s) Used
    A(A + B) + (B + AA)(A + B)Original Expression
    AA + AB + (B + A)A + (B + A)BIdempotent (AA to A), then Distributive, used twice.
    AB + (B + A)A + (B + A)BComplement, then Identity. (Strictly speaking, we also used the Commutative Law for each of these applications.)
    AB + BA + AA + BB + ABDistributive, two places.
    AB + BA + A + ABIdempotent (for the A's), then Complement and Identity to remove BB.
    AB + AB + AT + ABCommutative, Identity; setting up for the next step.
    AB + A(B + T + B)Distributive.
    AB + AIdentity, twice (depending how you count it).
    A + ABCommutative.
    (A + A)(A + B)Distributive.
    A + BComplement, Identity