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.