Thursday, July 21, 2011

A/L ICT

වැඩිම වෙසෙසි සංඛ්‍යාංකය - MSD
The most significant digit is the leftmost, non-zero digit in a number. It is the digit with the greatest value in the number.  in 2006.345 MSD is 2

අඩුම වෙසෙසි සංඛ්‍යාංකය - LSD
The least significant digit is the lowest digit in a number, located at the far right of a string. For example, in the number 2006, the "6" is the least significant digit.

Von Neumann architecture.

Introduced by John von Neumann
Parallel computers are referred as non-von Neumann architectures.

  • Comprised of four main components:
    • Memory
    • Control Unit
    • Arithmetic Logic Unit
    • Input/Output
  • Read/write, random access memory is used to store both program instructions and data
    • Program instructions are coded data which tell the computer to do something
    • Data is simply information to be used by the program
  • Control unit fetches instructions/data from memory, decodes the instructions and then sequentially coordinates operations to accomplish the programmed task.
  • Aritmetic Unit performs basic arithmetic operations
  • Input/Output is the interface to the human operator

    https://computing.llnl.gov/tutorials/parallel_comp/#Neumann
Parallel computers

multi-processor computer architectures
Instruction and Data.  x Single or Multiple.
Single Instruction Single Data (SISD)
Single Instruction Multiple Data (SIMD)
Multiple Instruction Single Data (SIMD)
Multiple Instruction Multiple Data MIMD)

Monday, July 18, 2011

How to Make Social Innovation by making Technology and Social Solutions

  • Innovation comes from constraints
  • when you have very few resources, you’re forced to be very creative in using and reusing them. That's simple isn't it?
  • Don’t fight culture, let peole be they are
  • Embrace market system - give as well as sell
  • Innovate on existing platforms rather than creating a totally new one.
  • Problems are not always obvious as you seen
  • Try living for a week on Rs 100/= a day to understand the poor.
  • Listen to the right people.
  • Do the hard work needed to find a simple and better solution. Its the key for innovation.
  • Leonardo da Vinci said, “Simplicity is the ultimate sophistication”
  • Create “transparent” re-usable and upgradable technologies. It should be easily understood by the users
  • Promote local and collaborative innovation. No one finds it alone.
  • Electrone was known to many people. Rutherfered confired it.
  • Make it inexpensive for the poor as well as for rich.
  • Provide skills, not just shopisticated technologies.
  • Do co-creation by teaching the skills to create solutions.
  • Involving the community throughout the design process.
  • Build capacity to help equip people to innovate and contribute to the evolution of the solution. It is real empowerment.
  • Be where the action is, not away from it.
  • Face the problem your self.
  • Work with people who have the problem
  • LISTEN to what they have to say  
  • Learn everything there is to know about it, Learning is a journey
  • Think big and act big – don’t plan to reach less than one million people, even if you implement for 100 or even for 10, think upscalability ...
  • Concept is everything, Good ideas evolve ecologically
  • Think like a child as have no limit to their thinking
  • Learn to see the obvious and do the obvious
  • If somebody already has invented it, design for measurable improvements
  • Work to practical, three-year plans , not less
  • Keep learning from your community and document and review
  • Be positive
  • Don’t be distracted by what other people think or say
  • Understand by observing the environment, infrastructure, culture and lives of people by being there.
  • Think creatively: start big, use constraints as a filter and find the simplest solutions.
  • Increase user acceptance
  • Beware of exsisiting costs
  • Beware of radically different ways of doing things.
  • Deliver value not just solutions.
  • Make what benefits people from end product
  • Ask how your solution improve life?
  • Think economic sustainability
  • Build financial motivations for continued growth over time.
  • Empower people by improving their economic or social status.
  • Share knowledge and skills to continue the innovative process
  • Keep a looking out for other challenges or new one
  • Dream Before Planning, Awake when planning, Sleep on the plan before making it work ...
  • Innovation never ends , it's a process not a milestone
adaptod from Design Africa Blog 

Sunday, July 10, 2011

How To Improve Your Memory Skills ?

Memory Skills
Following skills involves the use of memory and brain training


  • Remembering names after the first introduction
  • Navigating a new city using mental directions
  • Performance on IQ tests
  • Learning new subjects quickly and accurately
  • Recalling the location of objects
  • Calculating figures in your head
  • Remembering visual patterns

2 Attention

Cognitive exercises improve specific abilities related to attention.
  
  • Concentrating on new challenges
  •  Productivity at work or at home
  •  Driving safely and quickly
  •  Accuracy in sports like golf or tennis
  •  Avoiding distractions
  •  Peripheral vision
  •  Focusing on important tasks throughout your day

3 Speed  - Think fast.  
Speed includes a variety of cognitive skills that well-designed brain training can enhance.

    4 Flexibility  
    Flexibility training can make multitasking a breeze, help you articulate your thoughts better, and give you the discipline to resist temptation. Getting better at flexibility can help improve your precision, cognitive control, and your creative thinking.
     
    • Strategic planning
    • Multitasking quickly and efficiently
    • Thinking outside the box
    • Avoiding errors and mistakes
    • Communicating clearly
    • Resisting temptation and controlling impulses
    • Rapidly shifting your focus of attention

    5 Problem Solving
    Better problem solving skills can help you make quick, accurate decisions. Users that have trained their problem solving skills have reported a better ability to make mental estimates, comparisons, and calculations, not to mention more efficient thinking overall.
     
    • Performing mental calculations
    • Determining the best course of action from multiple options
    • Recognizing patterns and trends
    • Making quick, accurate estimations
    • Comparing different values
    • General aptitude with numbers
    • Dissecting complex arguments

  • Reaction time

  • Decision-making in time-sensitive situations

  • Determining the best route through busy traffic

  • Sense of direction

  • Speeding up other cognitive processes

  • Mental visualizations

  • Adapting to changing environments

  • Sunday, July 3, 2011

    Extracts from The Notebooks of Leonardo da Vinci

     Leonardo di ser Piero da Vinci (April 15, 1452 – May 2, 1519) was an Italian Renaissance polymath: painter, sculptor, architect, musician, scientist, mathematician, engineer, inventor, anatomist, geologist, cartographer, botanist and writer. Leonardo has often been described as the archetype of the Renaissance Man, a man of "unquenchable curiosity" and "feverishly inventive imagination".He is widely considered to be one of the greatest painters of all time and perhaps the most diversely talented person ever to have lived.

    Leonado Davinci Notes and Art


    Renaissance humanism saw no mutually exclusive polarities between the sciences and the arts, and Leonardo's studies in science and engineering are as impressive and innovative as his artistic work.These studies were recorded in notebooks comprising some 13,000 pages of notes and drawings, which fuse art and natural philosophy, made and maintained daily throughout Leonardo's life and travels, as he made continual observations of the world around him.


    These notebooks—originally loose papers of different types and sizes, distributed by friends after his death—have found their way into major collections such as the Royal Library at Windsor Castle, the Louvre, the Biblioteca Nacional de España, the Victoria and Albert Museum, the Biblioteca Ambrosiana in Milan which holds the twelve-volume Codex Atlanticus, and British Library in London.





    The greatest deception men suffer is from their own opinions.
    As a well-spent day brings happy sleep, so life well used brings happy death.

    Iron rusts from disuse; stagnant water loses its purity and in cold weather becomes frozen; even so does inaction sap the vigor of the mind.
    It is easier to resist at the beginning than at the end.

    Wisdom is the daughter of experience.

    Reprove your friend in secret and praise him openly.

    He who thinks little, errs much.

    He who wishes to be rich in a day will be hanged in a year.

    Life well spent is long.

    He who walks straight rarely falls.
    He who possesses most must be most afraid of loss.

    The acquisition of any knowledge is always of use to the intellect, because it may thus drive out useless things and retain the good. For nothing can be loved or hated unless it is first known.

    Truth was the only daughter of Time.

    Fear arises sooner than anything else.
    Obstacles cannot crush me. Every obstacle yields to stern resolve. He who is fixed to a star does not change his mind.

    We ought not to desire the impossible.

    The sun gives spirit and life to plants and the earth nourishes them with moisture.

    Just as courage imperils life, fear protects it.

    Where there is most feeling, there is the greatest martyrdom.

    Men out of fear will cling to the thing they most fear.

    Happy will they be who lend ear to the words of the Dead.


    O Time! consumer of all things; O envious age! thou dost destroy all things and devour all things with the relentless teeth of years, little by little in a slow death.
    No human research can be called true science unless it can be mathematically proved.

    We, by our arts may be called the grandsons of God.
    Human subtlety...will never devise an invention more beautiful, more simple or more direct than does nature, because in her inventions nothing is lacking, and nothing is superfluous.
    Oh! human stupidity, do you not perceive that, though you have been with yourself all your life, you are not yet aware of the thing you possess most of, that is of your folly? and then, with the crowd of sophists, you deceive yourselves and others, despising the mathematical sciences, in which truth dwells and the knowledge of the things included in them. And then you occupy yourself with miracles, and write that you possess information of those things of which the human mind is incapable and which cannot be proved by any instance from nature. And you fancy you have wrought miracles when you spoil a work of some speculative mind, and do not perceive that you are falling into the same error as that of a man who strips a tree of the ornament of its branches covered with leaves mingled with the scented blossoms or fruit.

    To lie is so vile, that even if it were in speaking well of godly things it would take off something from God's grace; and Truth is so excellent, that if it praises but small things they become noble.

    It is easier to contend with evil at the first than at the last.

    Man has much power of discourse which for the most part is vain and false; animals have but little, but it is useful and true, and a small truth is better than a great lie.

    What is fair in men, passes away, but not so in art.

    The knowledge of past times and of the places on the earth is both an ornament and nutriment to the human mind.

    In order to prove whether the spirit can speak or not, it is necessary in the first place to define what a voice is and how it is generated.

    Learning acquired in youth arrests the evil of old age; and if you understand that old age has wisdom for its food, you will so conduct yourself in youth that your old age will not lack for nourishment.

    Science is the captain, and practice the soldiers.
    The line has in itself neither matter nor substance and may rather be called an imaginary idea than a real object; and this being its nature it occupies no space. Therefore an infinite number of lines may be conceived of as intersecting each other at a point, which has no dimensions and is only of the thickness (if thickness it may be called) of one single line.

    I know that many will call this useless work.

    Tell me if anything was ever done. This was written in his notebooks in despair of so many projects that were never completed.



    A point is not part of a line.

    The painter who draws merely by practice and by eye, without any reason, is like a mirror which copies every thing placed in front of it without being conscious of their existence.

    Many will think they may reasonably blame me by alleging that my proofs are opposed to the authority of certain men held in the highest reverence by their inexperienced judgments; not considering that my works are the issue of pure and simple experience, who is the one true mistress. These rules are sufficient to enable you to know the true from the false— and this aids men to look only for things that are possible and with due moderation— and not to wrap yourself in ignorance, a thing which can have no good result, so that in despair you would give yourself up to melancholy.




    Shun those studies in which the work that results dies with the worker.

    The bones of the Dead will be seen to govern the fortunes of him who moves them. Of dice.

    It is true that impatience, the mother of stupidity, praises brevity, as if such persons had not life long enough to serve them to acquire a complete knowledge of one single subject, such as the human body; and then they want to comprehend the mind of God in which the universe is included, weighing it minutely and mincing it into infinite parts, as if they had to dissect it!

    Patience serves us against insults precisely as clothes do against the cold. For if you multiply your garments as the cold increases, that cold cannot hurt you; in the same way increase your patience under great offences, and they cannot hurt your feelings.


    You do ill if you praise, and still worse if you reprove in a matter you do not understand.

    The point, being indivisible, occupies no space. That which occupies no space is nothing. The limiting surface of one thing is the beginning of another.


    These rules will enable you to have a free and sound judgment; since good judgment is born of clear understanding, and a clear understanding comes of reasons derived from sound rules, and sound rules are the issue of sound experience— the common mother of all the sciences and arts. Hence, bearing in mind the precepts of my rules, you will be able, merely by your amended judgment, to criticise and recognise every thing that is out of proportion in a work, whether in the perspective or in the figures or any thing else.

    Those who are in love with practice without knowledge are like the sailor who gets into a ship without rudder or compass and who never can be certain whether he is going. Practice must always be founded on sound theory, and to this Perspective is the guide and the gateway; and without this nothing can be done well in the matter of drawing.

    Necessity is the mistress and guardian of Nature.

    Whoever in discussion adduces authority uses not intellect but rather memory.

    Let no man who is not a Mathematician read the elements of my work.

    Many have made a trade of delusions and false miracles, deceiving the stupid multitude. Pharisees— that is to say, friars.

    Be not false about the past.
    Movement will cease before we are weary of being useful.

    Truth at last cannot be hidden. Dissimulation is of no avail. Dissimulation is to no purpose before so great a judge. Falsehood puts on a mask. Nothing is hidden under the sun.

    The painter strives and competes with nature.

    If you transmit the rays of the sun through a hole in the shape of a star you will see a beautiful effect of perspective in the spot where the sun's rays fall.

    Darkness is absence of light. Shadow is diminution of light.
    Here forms, here colours, here the character of every part of the universe are concentrated to a point; and that point is so marvellous a thing ... Oh! marvellous, O stupendous Necessity— by thy laws thou dost compel every effect to be the direct result of its cause, by the shortest path. These are miracles... Of the eye.

    Though I may not, like them, be able to quote other authors, I shall rely on that which is much greater and more worthy— on experience, the mistress of their Masters.
    The smallest natural point is larger than all mathematical points, and this is proved because the natural point has continuity, and any thing that is continuous is infinitely divisible; but the mathematical point is indivisible because it has no size.

    The eye— which sees all objects reversed— retains the images for some time. This conclusion is proved by the results; because, the eye having gazed at light retains some impression of it. After looking (at it) there remain in the eye images of intense brightness, that make any less brilliant spot seem dark until the eye has lost the last trace of the impression of the stronger light.

    These rules are of use only in correcting the figures; since every man makes some mistakes in his first compositions and he who knows them not, cannot amend them. But you, knowing your errors, will correct your works and where you find mistakes amend them, and remember never to fall into them again. But if you try to apply these rules in composition you will never make an end, and will produce confusion in your works.

    If the Lord— who is the light of all things— vouchsafe to enlighten me, I will treat of Light; wherefore I will divide the present work into Parts... Linear Perspective, The Perspective of Colour, The Perspective of Disappearance.

    Among all the studies of natural causes and reasons Light chiefly delights the beholder; and among the great features of Mathematics the certainty of its demonstrations is what preeminently (tends to) elevate the mind of the investigator. Perspective, therefore, must be preferred to all the discourses and systems of human learning. In this branch [of science] the beam of light is explained on those methods of demonstration which form the glory not so much of Mathematics as of Physics and are graced with the flowers of both.

    The Book of the science of Mechanics must precede the Book of useful inventions.

    Amid the vastness of the things among which we live, the existence of nothingness holds the first place; its function extends over all things that have no existence, and its essence, as regards time, lies precisely between the past and the future, and has nothing in the present. This nothingness has the part equal to the whole, and the whole to the part, the divisible to the indivisible; and the product of the sum is the same whether we divide or multiply, and in addition as in subtraction; as is proved by arithmeticians by their tenth figure which represents zero; and its power has not extension among the things of Nature.

    That is not riches, which may be lost; virtue is our true good and the true reward of its possessor. That cannot be lost; that never deserts us, but when life leaves us. As to property and external riches, hold them with trembling; they often leave their possessor in contempt, and mocked at for having lost them.

    It seems to me that men of coarse and clumsy habits and of small knowledge do not deserve such fine instruments nor so great a variety of natural mechanism as men of speculation and of great knowledge; but merely a sack in which their food may be stowed and whence it may issue, since they cannot be judged to be any thing else than vehicles for food; for it seems to me they have nothing about them of the human species but the voice and the figure, and for all the rest are much below beasts.

    Good culture is born of a good disposition; and since the cause is more to be praised than the effect, I will rather praise a good disposition without culture, than good culture without the disposition.

    There is no certainty in sciences where one of the mathematical sciences cannot be applied, or which are not in relation with these mathematics.

     Of the horse I will say nothing because I know the times. This relates to a huge equestrian statue that Leonardo had been commissioned to design and create, but which was never cast until over 00 years later, in .

    A picture or representation of human figures, ought to be done in such a way as that the spectator may easily recognise, by means of their attitudes, the purpose in their minds.

    A shadow may be infinitely dark, and also of infinite degrees of absence of darkness. The beginnings and ends of shadow lie between the light and darkness and may be infinitely diminished and infinitely increased. Shadow is the means by which bodies display their form. The forms of bodies could not be understood in detail but for shadow.

    Those men who are inventors and interpreters between Nature and Man, as compared with boasters and declaimers of the works of others, must be regarded and not otherwise esteemed than as the object in front of a mirror, when compared with its image seen in the mirror.

    Mechanics is the paradise of the mathematical sciences because by means of it one comes to the fruits of mathematics.

    Reserve the great matters till the end, and the small matters give at the beginning.
    Wherever good fortune enters, envy lays siege to the place and attacks it; and when it departs, sorrow and repentance remain behind.

    I am not to blame for putting forward, in the course of my work on science, any general rule derived from a previous conclusion.

    Saturday, July 2, 2011

    How to work with Python Lists - Beginers Guide

    Consider list as numbered containers
    which can hold different data and objects


    It keeps objects in an order like an array, accessible like list[n].
    A list is a sequencial data structure which allows you to add and remove objects from
    the sequencial list.

    How to create Lists
        L = [] # creates an empty list
        L = [1,2,3] # list with Numbers
        L = ["A","B","C"] # list with Strings
        L = ["a:A","b:B","d:C"] # list with Key pairs
        L1 = [1,"A",L] # list with mixed data
        L = [a, b, c]# list with objects

               which may have a.move() like processes
        L = [expression, ...]


    You can put all kinds of objects in lists, including other lists, and multiple references to a
    single object.

    A = B = [] # both names points to the same list

    >>> A=B=[]
    >>> A=[1,2,3]
    >>> B
    []
    >>> A=B=[1,2,3]
    >>> A.pop()
    3
    >>> A
    [1, 2]
    >>> B
    [1, 2]
    >>>


    A = []
    B = A # both names will point to the same list

    A = []; B = [] # two independent lists


    How to Acces Lists

    len(L) # returns the number of items
    the first item is L[0]

    L[i:j] # creates a new list with objects between i and j.
        n = len(L)
        item = L[index]
        sequence = L[start:stop]


    L[-1]  # access the last item in a list.
    How to do Lists slicing
    seq = L[start:stop:step]
    seq = L[::2] # get every other item, starting with the first
    seq = L[1::2] # get every other item, starting with the second

    >>> A
    [1, 2, 3]
    >>> A[0:2]
    [1, 2]
    >>> A[0:2:2]
    [1]
    >>> A[0:2:1]
    [1, 2]
    >>>
    >>> A[0:4:1]
    [1, 2, 3]
    >>>


    How to Loop over Lists
    How to use for-in statement
        for item in L:
            print item

    How to use enumerate function with lists
        for index, item in enumerate(L):
            print index, item

    How to use range and len with lists
        for index in range(len(L)):
            print index


    >>> for a in A:
     print a
    1
    2
    3

    How to use explicit iterator
        i = iter(L)
        item = i.next() # fetch first value
        item = i.next() # fetch second value

    >>> i=iter(A)
    >>> i.next()
    1
    >>> i.next()
    2
    >>>


    How to sum list containing numbers
        v = sum(L)
        total = sum(L, subtotal)
        average = float(sum(L)) / len(L)

    >>> sum(A)
    6


    How to add individual items and slices
        L[i] = get one obj
        L[i:j] = slice sequence of items


    How to auto update list values
        L = []
        M = L

        # modify both lists M & L
        L.append(obj)


    >>> A.append(4)
    >>> A
    [1, 2, 3, 4]
    >>> B
    [1, 2, 3, 4]
    >>>

    How to create news lists
        L = [] # empty
        M = L[:] # create a copy

        # modify L only
        L.append(obj)


    >>> M=A[:]
    >>> M
    [1, 2, 3, 4]
    >>> B
    [1, 2, 3, 4]
    >>> M.append(5)
    >>> M
    [1, 2, 3, 4, 5]
    >>> A
    [1, 2, 3, 4]
    >>>

    How to insert an items to a list.
        L.append(item)# adds to the end
        L.insert(index, item)# inserts an item at a given index, moves rest down


    >>> M.insert(0, 0)
    >>> M
    [0, 1, 2, 3, 4, 5]



    How to delete items in a list    del L[i]
        del L[i:j]

    >>> del M[0]
    >>> M
    [1, 2, 3, 4, 5]

    >>> del M[0:1]
    >>> M
    [2, 3, 4, 5]
    >>>


    pop method removes an individual item and returns it,
    remove searches and removes the first matching item.

        item = L.pop() # last item
        item = L.pop(0) # first item
        item = L.pop(index)
        L.remove(item)

    >>> M.pop()
    5
    >>> M
    [2, 3, 4]

    The del and pop defference is pop returns the removed item.

    How to reverse a list.
        L.reverse()
    >>> M.reverse()
    >>> M
    [4, 3, 2]
    >>>


    Inserting/and deleting items on the top is fast if you use reverse
        L.reverse()
        # append/insert/pop/delete at far end
        L.reverse()


    >>> M.append(1)
    >>> M.reverse()
    >>> M
    [1, 2, 3, 4]
    >>>


    How sort lists and get a sorted copy
        L.sort() # sort L, L changed
       out = sorted(L) # returns a sorted copy L not changed


    >>> M
    [1, 2, 3, 4]
    >>> M.insert(2,5)
    >>> M
    [1, 2, 5, 3, 4]
    >>> M
    [1, 2, 5, 3, 4]
    >>> M.sort()
    >>> M
    [1, 2, 3, 4, 5]
    >>>


    How to get the smallest or largest item
        lo = min(L)
        hi = max(L)


    >>> max(M)
    5
    >>> min(M)
    1
    >>>


    Be careful when deleting in a loop
    for object in L[:]:
        if not condition:
                del L[index]
    this can create problem as for keeps an internal index
    create a new list and append items
    out = []
    for object in L:
         if condition:
             out.append(object)
    finally remove L

    How to implement stack data structure with lists
        stack = []
        stack.append(object) # push
        object = stack.pop() # pop from end

    How to implement queue data structure with lists
        queue = []
        queue.append(object) # push
        object = queue.pop(0) # pop from beginning


    How to search in lists
        if value in L:
            print "list contains", value


    How get the index of the first matching item
        i = L.index(value)

    To get all matching items, use a loop, passing a start index:

        def findall(L, value, start=0):
            # generator version
            i = start - 1
            try:
                i = L.index(value, i+1)
                yield i
            except ValueError:
                pass

        for index in findall(L, value):
            print "match at", i


    If you need to count matching items
        n = L.count(value)