Friday, February 16, 2018

micro:bit ශූරතාවලිය - අවසාන ප්‍රතිඵල

මයික්‍රෝබිට් මිතුරනි,
ශ්‍රී ලංකා ජාතික ගීය, මයික්‍රෝ මරියෝ, ෆ්ලැපි කුරුල්ලා, පොර පොල්, මයික්‍රෝ නැටුම වැනි අගනා micro:bit නිර්මාණ 400 කට වඩා ඉදිරිපත්වූ පළමු micro:bit ශූරතාවලිය අනාගත බලාපොරොත්තු රැසක් සමග සාර්ථකව සිදුඋනා. අප ලද වඩාත් අගනා ප්‍රතිඵලය IoT හා robotics සඳහා පරිගණක විද්‍යාව, කේතනය හා ඇලොගරිතම ඉගනීමට දැනුම සම්භාරයක් ප්‍රජාව මුල්කරගන http://microbit.info.lk හි නිර්මාණය වීමයි. දැන් ICT සිසුනට හා ගුරුවරුන්ට ඒවා භාවිතා කර micro:bit කේතනය ඉගනීමට හැකි වේවි. ලොව පුරා සිසුන්, ගුරුවරුන් හා තාක්‍ෂණඥයින්ගේ micro:bit ප්‍රජාවක්ද microbit club වටා ගොඩනැගීමද, ඔවුනොවුන් හඳුනා ගැනීමටද අපට සැමට අවස්ථාව ලැබුණා. අප දැන් 1300 කට වඩා සමූහයක්. ශූරතාවය තුලින්
අප සැම ගොඩක් දේ ඉගෙන ගත්තා. එයට ඔබ සැමට ස්තූතියි.

micro:bit ශූරතාවලියේ ප්‍රතිඵල!
14 න් පහළ micro:bit ශූරයා චමිත් ඉඳුවර (නිර්මාණ 21, මනාප 457)
19 න් පහළ micro:bit ශූරයා හිමාෂ් තිලකරත්න (නිර්මාණ 21 මනාප 250)
විශ්ව විද්‍යාල micro:bit ශූරයා කසුන් දිසානායක (නිර්මාණ 23 මනාප 612)
ගුරුවරුන්ගේ micro:bit ශූරයා උමාර රත්නායක (නිර්මාණ 5 මනාප 65)
විවෘත micro:bit ශූරයා ඉවාන් බොස්නික් (නිර්මාණ 27 මනාප 117)
විශේෂ සඳහන් කිරීම්!
14 න් පහළ - සිතුම් දුලේන් ප්‍රනාන්දු, හබීබා ඈන්ස්, අසීම් ෆයිසාල්, ඉනුකි වික්‍රමතිලක
19 න් පහල - හන්සල සෙනවිරත්න, නදූෂන් , ටී මුරලි
විශ්ව විද්‍යාල - ක්‍රිස්ටීන් ප්‍රනාන්දු
ගුරුවරු - ජිනානි වලිසුන්දර
විවෘත - ඇලෙක්ස් ෆ්ලෝරිජාන්, සිමුන් බිලාස්, නිකෝලා පෙට්රොවික්, එන් වීරකුමාර , විශ්ව කුමාර
micro:bit ශූරතාවලියේ ජයග්‍රාහකයන්ටත්, සහභාගී වූ සැමටත්, එය නැරඹා නිර්මාණ අගය කල ඔබ සැමටත් microbit club, shilpa64 හා algohack ප්‍රණාමය.
ඊළඟට micro:bit ලෝක ශූරතාවලය ගණිතය ගැන.
විස්තර ලගඳීම. නැවතත් ස්තූතියි. මෙය Share කරන්න.
micro:bit තාක්‍ෂණ අධ්‍යාපනයට වැදගත්ම උපකරණයක්.
විස්තර සඳහා බලන්න. http://microbit.info.lk
සංවිධානය හා තාක්‍ෂණය
Poornima Heashadharani (microbit club)
Sagara Ekanayake (Silicon Hills)
Niranjan Meegammana (Shilpa Sayura Foundation)
NP Vishva Kumara (info.lk)
Yamuna Rathnayake (RRCK)
තවත් විස්තර!
ශූරතාවලිය :https://goo.gl/VRARSD
තරඟ ප්‍රශ්ණ : https://goo.gl/upKGUf
තරඟ නිර්මාණ http://microbit.info.lk
මයික්‍රෝබිට් පාඩම් : https://goo.gl/31qKry
සංවිධානය : http://shilpasayura.org සහ ප්‍රජාව
අනුග්‍රහය හා මයික්‍රෝබිට් ලබාදීම http://microbitclub.info.lk

Intelligent Mario with gravity and thrust

Thursday, February 15, 2018

Model View Controller (MVC) Pattern with Java Script



The Controller (C) listens to event stream.  Here we use click event

Model (M) provide access to data source.

View (V) knows how to render data from the Model.

The Controller tells to View to do something with Model data.
The View knows nothing about the Model apart from it's interface
The Model knows nothing of the View and the Controller
The Controller knows about both the Model and the View
The Controller tells the View to do something with the data from the Model

You need to add form input elements and a button to experiment this code.


var M = {}, V = {}, C = {};

/* Controller Handles the Events */
/* Model Handles the Data */
/* View Handles the Display */


M = {
    data: {
        userName : "Ping Pong",
        userID : "440"
    }, 
    setData : function(d){
        this.data.userName = d.userName;
        this.data.userID = d.userID;
    },
    getData : function(){
        return data;
    }
}

//elements who will receive data
V = {
    userName : document.querySelector("#inputUserName"),
    userID : document.querySelector("#inputUserID"),
    update: function(M){
        this.userName.value = M.data.userName;
        this.userID.value = M.data.userID;
    }
}

//Controller handles all
C = {
    model: M,
    view: V,
    handler: function(){
        this.view.update(this.model);
    }
}

//event
document.querySelector("#submitBtn").addEventListener("click", function(){
    C.handler.call(C);
}); 

Wednesday, February 14, 2018

PHP MySQLi object oriented implementation

MySQLi - i standing for 'improved'.

PDO
PDO works with various different database systems
MySQLi will only work with MySQL databases.
Both are object oriented, but MySQLi allows procedural usage also.

PHP MySQLi object oriented implementation,

Connecting
Create a new instance of MySQLi on localhost database

$db = new mysqli('localhost', 'mysql_database', 'pass', 'demo');

if($db->connect_errno > 0){
    die('Unable to connect to database [' . $db->connect_error . ']');
}

Querying

$sql = SELECT * FROM `users` WHERE `live` = 1
$result = $db->query($sql)

if(!$result ){
    die('There was an error running the query [' . $db->error . ']');
}

Output query results
To loop through the results and output the username

while($row = $result->fetch_assoc()){
    echo $row['username'] . '<br />';
}


Number of returned rows


<?php
echo 'Total results: ' . $result->num_rows;
?>

Number of affected rows

<?php
echo 'Total rows updated: ' . $db->affected_rows;
?>

Free result set
It's advisable to free a result after use

$result->free();

This will free up some system resources, and is a good practice to get in the habit of doing.

Escaping characters

$db->real_escape_string('This is an unescaped "string"');

$db->escape_string('This is an unescape "string"');
The string should now be safer to insert into your database through a query.

 close the connection:

$db->close();

Define a statement

$statment = $db->prepare("SELECT `name` FROM `users` WHERE `username` = ?");

Bind parameters
$name = 'Bob';
$statement->bind_param('s', $name);
Execute the statement
$statement->execute();

Iterating over results

$statement->bind_result($returned_name);

while($statement->fetch()){
    echo $returned_name . '<br />';
}

Close statement

$statement->free_result();

MySQLi Transactions

Disable auto commit
You need to make it so that any query you submit doesn't automatically commit in the database.

$db->autocommit(FALSE);

Commit the queries
After a few queries that you've ran using $db->query()
 we can call a simple function to commit the transaction:

$db->commit();

Rollback
 roll something back:

$db->rollback();

Friday, February 9, 2018

IP & Subnet Calculator

  • IP Address:
  • Subnet Mask:
  • Subnets:
  • Hosts:
  • Class:
Decimal Binary
Network ID
Subnet ID
First Host
Last Host
Broadcast Address
Subnet Mask
Wildcard Mask

Saturday, February 3, 2018

What is a proxy Server ?


proxy server is a server that acts as an intermediary for requests from clients
and seeks resources from other servers

A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource available from a different server and the proxy server evaluates the request as a way to simplify and control its complexity.
Diagram of two computers connected only via a proxy server. The first computer says to the proxy server: "ask the second computer what the time is".
HTTP Proxy – The HTTP proxy works with web browsers (HTTP clients) and servers that support HTTP. The HTTP proxy caches pages, or store them, for faster retrieval and are used occasionally to increase metadata services available on the website.



Gateway Proxy – A proxy that allows requests and information to travel through without modification is called a gateway, or gateway proxy. T

Content Filter – The filter that might be blocking the sites you wish to access is likely a form of a proxy as well. These specialized proxies called content filters require all requests to pass through for review. The content filter proxy then blocks requests that match requests on a "black list" or based on certain security settings. Depending on the complexity of the content filter, network administrators can add to or remove items from the black list.

DNS Proxy - A DNS proxy server takes DNS queries from a ( Usually local ) networks and forwards them to an Internet Domain Name Server. It may also cache DNS records.

Anonymous HTTPS proxy - Users wanting to bypass web filtering, that want to prevent anyone from monitoring what they are doing, will typically search the internet for an open and anonymous HTTPS transparent proxy. T

Use of HTTPS proxies are detectable even without examining the encrypted data, based simply on firewall monitoring of addresses for frequency of use and bandwidth usage. 


TOR Proxy - Tor ( The Onion Router) is a system intended to enable online anonymity. Tor client software routes Internet traffic through a worldwide volunteer network of servers in order to conceal a user's location or usage from someone conducting network surveillance or traffic analysis. Using Tor makes it more difficult to trace Internet activity, including "visits to Web sites, online posts,

I2P anonymous proxy - The I2P anonymous network ( I2P ) is a proxy network aiming at online anonymity. It implements garlic routing, which is an enhancement of Tor's onion routing. I2P is fully distributed and works by encrypting all communications in various layers and relaying them through a network of routers run by volunteers in various locations. By keeping the source of the information hidden, I2P offers censorship resistance. The goals of I2P are to protect users' personal freedom, privacy, and ability to conduct confidential business.

Each user of I2P runs an I2P router on their computer (node). The I2P router takes care of finding other peers and building anonymizing tunnels through them. I2P provides proxies for all protocols (HTTP, IRC, SOCKS, ...).
USES OF PROXIES
  1. Filtering of encrypted data
  2. Bypassing filters and censorship
  3. Logging and eavesdropping
  4. Improving performance
  5. Security
  6. Cross-domain resources
  7. Translation
  8. Anonymousity

SECURE SOCKET LAYER

HTTPS protocol
SSL (Secure Sockets Layer)
is the most widely used.

It is the  standard security technology today.
It establishes an encrypted link
Between a web server and a browser.

HTTP and HTTPS
HTTP link is not encrypted
HTPS is encrypted and secure communication.

How HTTP and HTTPS work?
A (client) and B (server) are two devices.
A sends password to B
B receive password.
hacker access in between.

If A sends “badpass”, hacker gets “badpass”.
In HTTPS
SSL communication used to encript messages.
A sends message on the network.
B receive themessage on the network.
Now hacker see password as “xYhVIO9l”
How SSL works?
A SSL Certificate issued to a websites by a certifying agency. A security certificate installed in web server with SSL capability..


SSL system consists of a Public key and a Private key. Public key is used to encrypt the information
Private key is used to decrypt it.

Monday, January 29, 2018

Issues of IoT

Image result for IoT

• Cyber security
• Privacy
• Software licensing
• Data use and ownership
• Regulation

IoT cyber security is a moving target. When a patch or fix is developed, it’s only a matter of time
before hackers find ways around it. In situations where IoT security is breached, who is liable? Is the
software maker liable if it doesn’t update its software? Who is liable if the software maker updates its software, but the user doesn’t
download the update? What happens if the software maker updates the software, but the user doesn’t know there’s an update?

Privacy and Laws
Privacy laws vary across countries. The Europeans are very protective
of privacy, and the US is less protective. Video rental habits are protected by federal laws,
not clear to of data generated by an implantable cardiac monitor is protected. Who owns datathat describes the quality and quantity of your heartbeats.

Governing the Internet of Things

Software Licensing—It’s Complicated
IoT requires software and hardware from multiple vendors.
Maintaining the software, hardware stack can be expensive.
In the IoT economy, there will be a handful of end-to-end solutions and a broad assortment of mash-ups.

Data Use and Ownership—Who Controls What?
who owns what data, where can it be sent, who is allowed to use it and how much if
it can be stored across the IoT landscape.

As the IoT becomes a more dominant force in our lives, the data it generates will become more valuable. Since the laws governing data ownership are ambiguous, rights associated with ownership are so unclear, look at who controls the use of data. It should be the consumer

Autonomous driving raises questions about data ownership and usage.
If a driverless car is involved in an accident, who is liable and who is allowed to review data relating to the accident? Will the manufacturer of the car want to see the data so it can lodge a suit against the developer who wrote the navigational software? Will network providers be required to share data with law enforcement agencies when autonomous vehicles collide?
Many questions but few answers yet .

Government regulation—or the lack of it
In the driverless car, precisely who is responsible in case of an accident—the owner of the car,
the company that made the car, or the company that wrote the software
guiding the car?

Wednesday, January 24, 2018

Subnetting in 5 minutes



192.168.1.7 is an IP in IPV4 standard
IPV4 networks have 32bits.
Each 8bit is a Network ID.
Each Network ID represent number between 0-255

There are 4 basic classes A , B C, D
The first ID or 8 bits is network class
0-127 - Class A
128 - 191 Class B
192 -  223 Class C
223 + Class D & E kept for research purpose

Class First Network ID Last Network ID
Class A 1.0.0.0 126.0.0.0
Class B 128.0.0.0 191.255.0.0
Class C 192.0.0.0 223.255.255.0

If we have a class C network
The first 3 numbers are network ID  192.168.1
The last number is host ID
First host id (0) is network id and last (255 broadcast id) not used
So in the network we have host ids from
192.168.1.1 - 192.168.1.254 we can have 254 hosts (computers or devices)
We do sub netting to separate network traffic , like partitioning  house.
we can make 2 networks each having 254/2 - 1*2  hosts
or make 4 networks having  254/4 - 1 *4

Every time we break the network the first and last host IDs are used as subnets network ID and broadcast ID.

Broadcast address used to send data to all hosts.
So they cant be used  as host IDs..
A disadvantage of subnetting is reducing of usable IPs in a network.

In order to tell the network how many computers we have in the subnet we use a subnet mask. Another number which tells how many subnet networks have been created.
When we have 254 computers in a class C network we use
255.255.255.0 as subnet mask so 192.168.1.1- 192.168.1.255 ips available to us.
When we break the network into two subnets. We have to put a boundry between them by changing the subnet mask.

Here subnet mask borrow one bit from host ID
so subnet mask becomes 255.255.255.128
The IP range of sub network A now is 192.168.1.1- 192.168.1.126
The IP range of sub network B now is 192.168.1.129- 192.168.1.253
The first and last IP of each subnet used for subnetworkid and broadcast address.

Check here
http://www.subnet-calculator.com/

 In detail http://ict.shilpa64.lk

Sunday, January 21, 2018

උසස් පෙළ ICT ආදර්ශ ප්‍රශ්න පත්‍රය

අපොස උසස්පෙළ සඳහා ගුරුවරුන් රැසක් සම්පාදනය කළ ආදර්ශ ප්‍රශ්න. උත්සාහ කර බලන්න.

Download

O/L ICT, GIT, A/L ICT කෙටි ප්‍රශ්න 200 ක්

අපොස සාමාන්‍ය පෙළ ICT සමත් නොවී උසස් පෙළ ICT කරන අයට හා GIT සඳහා වැදගත් O/L ICT කෙටි ප්‍රශ්න 200 ක් උත්සාහ කර බලන්න. ICT කරන සෑම අයෙකුටම සුදුසුයි.

Download