Difference between revisions of "Internet Technologies and Techniques"

From Notebook
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 56: Line 56:
 
Databases  
 
Databases  
  
using databases to manage the webstore
+
using databases to manage the webstore. We will be using LAMP stack for managing this. LAMP = linux, apache, mySQL, php
 +
 
 +
$ mysql -u php-server -p , means that we will me authenticating user php with a password. '
 +
my sql commands are always in all caps and are followed by semicolons at the end. for eg. SHOW DATABASE;
 +
 
 +
Creating a atable in a database,
 +
 
 +
mysql> CREATE TABLE `person` (
 +
    -> `id` INT UNSIGNED AUTO_INCREMENT,
 +
    -> `first_name` VARCHAR(250) COLLATE UTF8_SWEDISH_CI,
 +
    -> `last_name` VARCHAR(250) COLLATE UTF8_SWEDISH_CI,
 +
    -> PRIMARY KEY (`id`)
 +
    -> );
 +
 
 +
 
 +
 
 +
USE BACK TICKS AND NOT APOSTROPHES. ``````````````````````vs ''''''''''''''''''''''''''''''''''''''''
 +
 
 +
populating tables
 +
mysql> INSERT INTO person (first_name, last_name)
 +
    -> VALUES ('s', 'k');
 +
 
 +
deleting someone
 +
mysql> DELETE FROM person WHERE id='1';
 +
 
 +
 
 +
Changing user id
 +
mysql> UPDATE person
 +
    -> SET first_name='name', last_name='bleh'
 +
    -> WHERE id='2';
 +
 
 +
Adding a row to existing database
 +
mysql> ALTER TABLE person
 +
    -> ADD `adress` VARCHAR(250) COLLATE UTF8_SWEDISH_CI;
 +
 
 +
To make alterations within tables
 +
ALTER TABLE person CHANGE `adress` `address` VARCHAR(250) COLLATE UTF8_SWEDISH_CI;
 +
 
 +
==Day 6==
 +
 
 +
Using phpmyadmin for creating and populating databases
 +
 
 +
creating store front.
 +
 
 +
in nano editor --->
 +
 
 +
 
 +
<?php
 +
$database = "localhost";
 +
$username = "php-server";
 +
$password = "password";
 +
 
 +
$connection = new mysqli($database, $username, $password);
 +
 
 +
if ($connection->connect_error){
 +
    die("connection failed: " . $connection->connect_error);
 +
}
 +
echo "Connected succesfully";
 +
 
 +
?>
 +
 
 +
 
 +
 
 +
<!DOCTYPE html>
 +
<head>
 +
        <meta charset="UTF-8">
 +
</head>
 +
 
 +
<body>
 +
this is going to be my webstore
 +
</body>

Latest revision as of 09:29, 29 November 2017

Learning Diary

Day 1

http://www.devjavasoft.org/FirstEdition/programmingFundamentals.pdf

Application layer

Top level of stack

(Application layer protocols, protocol = established agreed way of sharing info)

HTTP, FTP, RTSP, IMAP/POP...

using telnet in terminal to connect to sputnik.media.aalto.fi

Commands in terminal -

telnet sputnik.media.aalto.fi 80

GET http://sputnik.media.aalto.fi/ HTTP/1.0


port 80, default port for HTTP connections. IMAP/POP, port 143

DNS = domain name server, basically a server that knows what name links to what ip address of the server.

For eg. to access sputnik.media.aalto.fi, TLD = top level DNS which redirects to local .fi DNS which would send to aalto DNS so on...

Look up - ICANN,

Transport layer

TCP Transmission control protocol Checks for connections, if everything is ok, errors etc., it guarantees that the information that is requested, will be received in whole without drops etc. retransmits lost packages.

UDP user datagram protocol = gets the data as fast as possible, but no guarantees for drops or right order etc., no error correction.

IP

Internet layer, handles routing of connections , independent of hardware. Traceroute in terminal/network utility shows the routes through multiple servers.


ssh in terminal is the way to connect to a remote computer.

ls lists files on the computer.

nano, text editor for terminal.

Day 3

using PHP to make a random counter

Day 4

Using PHP to implement web store basics.

Day 5

Databases

using databases to manage the webstore. We will be using LAMP stack for managing this. LAMP = linux, apache, mySQL, php

$ mysql -u php-server -p , means that we will me authenticating user php with a password. ' my sql commands are always in all caps and are followed by semicolons at the end. for eg. SHOW DATABASE;

Creating a atable in a database,

mysql> CREATE TABLE `person` (

   -> `id` INT UNSIGNED AUTO_INCREMENT,
   -> `first_name` VARCHAR(250) COLLATE UTF8_SWEDISH_CI,
   -> `last_name` VARCHAR(250) COLLATE UTF8_SWEDISH_CI,
   -> PRIMARY KEY (`id`)
   -> );


USE BACK TICKS AND NOT APOSTROPHES. ``````````````````````vs '''''''''''''''''''''''''''''''''''

populating tables mysql> INSERT INTO person (first_name, last_name)

   -> VALUES ('s', 'k'); 

deleting someone mysql> DELETE FROM person WHERE id='1';


Changing user id mysql> UPDATE person

   -> SET first_name='name', last_name='bleh' 
   -> WHERE id='2';

Adding a row to existing database mysql> ALTER TABLE person

   -> ADD `adress` VARCHAR(250) COLLATE UTF8_SWEDISH_CI; 

To make alterations within tables ALTER TABLE person CHANGE `adress` `address` VARCHAR(250) COLLATE UTF8_SWEDISH_CI;

Day 6

Using phpmyadmin for creating and populating databases

creating store front.

in nano editor --->


<?php $database = "localhost"; $username = "php-server"; $password = "password";

$connection = new mysqli($database, $username, $password);

if ($connection->connect_error){

    die("connection failed: " . $connection->connect_error);

} echo "Connected succesfully";

?>


<!DOCTYPE html> <head>

       <meta charset="UTF-8">

</head>

<body> this is going to be my webstore </body>