koding lourdeshm

91
INSTITUTO TECNOLOGICO DE CURSO DE KODING María de Lourdes Hernández Martínez 11 al 15 de Enero de 2016

Upload: rudy-vasquez-p

Post on 06-Jul-2016

23 views

Category:

Documents


1 download

DESCRIPTION

Koding

TRANSCRIPT

Page 1: koding LOURDESHM

INSTITUTO TECNOLOGICO DE TUXTEPEC

CURSO DE KODING

María de Lourdes Hernández Martínez

11 al 15 de Enero de 2016

Page 2: koding LOURDESHM

2

ÍNDICE

Tabla de Actividades

1) Crear cuenta de Koding………………………………………………………………………………………………….32) Ejercicio a realizar………………………………………………………………..………………………………………213) Practica de comandos…………………………………………………………………………….…………….……..254) Actividad a realizar……………………………………………………………………………………………………...43

Page 3: koding LOURDESHM

3

1) CREAR CUENTA DE KODING

Para poder crear la cuenta de Koding damos click en la pestaña superior izquierda

Page 4: koding LOURDESHM

4

Te pide tu cuenta de correo y contraseña para dar de alta la cuenta de Koding

Nos llega al correo un código para confirmar la cuenta

Page 5: koding LOURDESHM

5

Aquí nos pide verificar el código que nos llegó al correo

Page 6: koding LOURDESHM

6

Page 7: koding LOURDESHM

7

Una vez que entramos aparece la sig. Ventana para trabajar

Page 8: koding LOURDESHM

8

Page 9: koding LOURDESHM

9

Comando ls –l

Lista privilegios y archivos ocultos

Page 10: koding LOURDESHM

10

Comando ls –la

Page 11: koding LOURDESHM

11

Ls –la /var/

Page 12: koding LOURDESHM

12

Crea archivo

Page 13: koding LOURDESHM

13

Page 14: koding LOURDESHM

14

Page 15: koding LOURDESHM

15

Page 16: koding LOURDESHM

16

Page 17: koding LOURDESHM

17

Page 18: koding LOURDESHM

18

Page 19: koding LOURDESHM

19

Page 20: koding LOURDESHM

20

Page 21: koding LOURDESHM

21

Page 22: koding LOURDESHM

22

2) EJERCICIO A REALIZAR1) CREAR UN DIRECTORIO CON EL NOMBRE DE PROGRAMAS SOBRE SU DIRECTORIO DE

TRABAJO home/usuario2) SOBRE EL DIRECTORIO PROGRAMAS CREAR EL ARCHIVO info.php CON EL SIG. CONTENIDO:

<?php Phpinfo();?>

3) CREAR UN DIRECTORIO SOBRE EL DIRECTORIO midirectorio CON EL NOMBRE scripts

Page 23: koding LOURDESHM

23

4) COPIAR EL ARCHIVO info.php QUE ESTA EN PROGRAMAS AL DIRECTORIO scripts CON EL NOMBRE DE test.php

Page 24: koding LOURDESHM

24

5) CAMBIAR LOS PRIVILEGIOS DEL ARCHIVO test.php PARA QUE TENGAQ LOS SIG. PRIVILEGIOS rwx rw –r –x

Page 25: koding LOURDESHM

25

Page 26: koding LOURDESHM

26

3) PRACTICA DE COMANDOS

Comando df –h muestra información del sistema de archivos del uso de espacio en disco en todas las particiones montadas

Page 27: koding LOURDESHM

27

du este comando muestra el uso del espacio de un disco de directorio

Page 28: koding LOURDESHM

28

free muestra la cantidad de memoria libre y usada en el sistema

Page 29: koding LOURDESHM

29

free –m da la información en megabyte

Page 30: koding LOURDESHM

30

top muestra información del sistema Linux. Con q te sales

Page 31: koding LOURDESHM

31

uname -a muestra toda la información del sistema, nombre del equipo, kernel, versión y otros detalles

Page 32: koding LOURDESHM

32

lsb_release –a muestra la información de la versión del sistema op. de linux ejecutado

Page 33: koding LOURDESHM

33

ifconfig información de las interfaces

Page 34: koding LOURDESHM

34

4) EDITAR LOS ARCHIVOS DE LAS PAG. Y PONERLOS EN ESPAÑOL

INDEX

Page 35: koding LOURDESHM

35

PERL

Page 36: koding LOURDESHM

36

Page 37: koding LOURDESHM

37

PHP

Page 38: koding LOURDESHM

38

Page 39: koding LOURDESHM

39

PYTHON

Page 40: koding LOURDESHM

40

Page 41: koding LOURDESHM

41

RUBY

Page 42: koding LOURDESHM

42

Page 43: koding LOURDESHM

43

Page 44: koding LOURDESHM

44

5) ACTIVIDAD A REALIZAR

1. Crear una carpeta llamada mispaginas dentro de la carpeta web

2. Copiar el archivo index.html en la carpeta mispaginas

Page 45: koding LOURDESHM

45

3. Verificar en el navegador al acceso a este archivo tecleando el nombre de dominio de la sig. forma luluhm.koding.io/mispaginas/

Page 46: koding LOURDESHM

46

4. Tomando como base el archivo index.html, modificarlo para presentar el contenido de alguna de sus materias que incluya

a. Nombre de la materiab. Objetivoc. Contenido temático(tabla)

Page 47: koding LOURDESHM

47

INSTALANDO FTP CON vsftpd

Page 48: koding LOURDESHM

48

sudo apt-get update

Page 49: koding LOURDESHM

49

Instalando vsftpd: sudo apt-get install vsftpd

Page 50: koding LOURDESHM

50

Configurando el vsftpd: sudo nano /etc/vsftpd.conf

Page 51: koding LOURDESHM

51

Cambiar password

Page 52: koding LOURDESHM

52

Descargar el cliente filezilla

Page 53: koding LOURDESHM

53

Page 54: koding LOURDESHM

54

Ejecutar el cliente filazila y conectarse a la máquina virtual

Page 55: koding LOURDESHM

55

copiar info.php de programas a mispaginas

Page 56: koding LOURDESHM

56

RESOLVIENDO ECUACION DE SEGUNDO GRADO

ecuaciones.html

<head>

<title>soloucion de una ecuacion de segundo grado..</title>

</head>

<body>

<center>

<h1>solucion de una ecuacion de segundo grado</h1>

<p><hr><p>

<form action="ecuacion.php" method="post">

valor del coeficiente a:

<input type="text" name="a" size=5><p>

valor del coeficiente b:

<input type="text" name="b" size=5><p>

valor del coeficiente c:

<input type="text" name="c" size=5><p>

<p><hr><p>

<input type="submit" value="Calcular">

</form>

</center>

</body>

</html>

ecuaciones.phh

<html>

<center>

<h1>Solucion de una Ecuacion de 2do. Grado</h1>

<p><hr><p><h2>

Page 57: koding LOURDESHM

57

<?php

$a=$_POST['a'];

$b=$_POST['b'];

$c=$_POST['c'];

echo "La solucion de la Ecuacion ";

echo $a."x<sup>2</sup>+".$b."x+".$c."=0 es:<p>";

$d=pow($b,2)-4*$a*$c;

if($d>0)

{

$x1=(-$b+sqrt($d))/(2*$a);

$x2=(-$b-sqrt($d))/(2*$a);

printf("x1=%5.2f<br>",$x1);

printf("x2=%5.2f<br>",$x2);

echo $cad;

}

elseif ($d==0) {

$x1=-$b/(2*$a);

$x2=$x1;

echo "x1=",$x1,"<br>";

echo "x2=",$x2,"<br>";

}

else

echo "La ecuacion no tiene solucion!!!";

?>

Page 58: koding LOURDESHM

58

Page 59: koding LOURDESHM

59

SISTEMA DE CONVERSIONES DE BASE

conversiones.php

<?php

echo "<center><h1>Sistema de conversion de Base</h1>";

echo "<br><hr><br>";

?>

<form action="?" method="post">

Numero: <input type="text" name="num" size="6"><br>

Base a convertir:

<select name="bases">

<option value="">Seleccione una base </option>

<option value="1">Decimal -> Binario </option>

<option value="2">Binario -> Decimal </option>

<option value="3">Decimal -> Octal </option>

<option value="4">Octal -> Decimal </option>

<option value="5">Decimal -> Hexadecimal </option>

<option value="6">HexaDecimal -> Decimal </option>

<option value="7">Binario -> Octal</option>

<option value="8">Octal -> Binario </option>

<option value="9">Binario -> Hexadecimal </option>

<option value="10">Hexadecimal -> Binario </option>

<option value="11">Octal -> Hexadecimal </option>

<option value="12">HexaDecimal -> Octal </option>

</select><br>

<input type="submit" name="convierte" value=" C o n v e r t i r ">

<br>

<?php

if (isset($_REQUEST['convierte'])){

echo "<h2>Sistema de Conversion de Base </h2>";

Page 60: koding LOURDESHM

60

echo "<hr>";

$opc=$_POST['bases'];

$num=$_POST['num'];

switch ($opc){

case "1": echo "Decimal a Binario = ".$num."<sub>10</sub> -->".DecBin($num)."<sub>2</sub><br>";

break;

case "2": echo "Binario a Decimal = ".$num."<sub>2</sub> -->".BinDec($num)."<sub>10</sub><br>";

break;

case "3": echo "Decimal a Octal = ".$num."<sub>10</sub> -->".DecOct($num)."<sub>8</sub><br>";

break;

case "4": echo "Octal a Decimal = ".$num."<sub>8</sub> -->".OctDec($num)."<sub>10</sub><br>";

break;

case "5": echo "Decimal a Hexadecimal = ".$num."<sub>10</sub> -->".DecHex($num)."<sub>16</sub><br>";

break;

case "6": echo "Hexadecimal a Decimal = ".$num."<sub>16</sub> -->".HexDec($num)."<sub>10</sub><br>";

break;

case "7": $a=BinDec($num);

echo "Binario a Octal = ".$num."<sub>2</sub> -->".DecOct($a)."<sub>8</sub><br>";

break;

case "8": $a=OctDec($num);

echo "Octal a Binario = ".$num."<sub>8</sub> -->".DecBin($a)."<sub>2</sub><br>";

break;

case "9": $a=BinDec($num);

echo "Binario a Hexadecimal = ".$num."<sub>2</sub> -->".DecHex($a)."<sub>16</sub><br>";

Page 61: koding LOURDESHM

61

break;

case "10": $a=HexDec($num);

echo "Hexadecimal a Binario = ".$num."<sub>16</sub> -->".DecBin($a)."<sub>2</sub><br>";

break;

case "11": $a=OctDec($num);

echo "Octal a Hexadecimal = ".$num."<sub>8</sub> -->".DecHex($a)."<sub>16</sub><br>";

break;

case "12": $a=HexDec($num);

echo "Hexadecimal a Octal = ".$num."<sub>16</sub> -->".DecOct($a)."<sub>2</sub><br>";

break;

}

echo "<hr>";

}

?>

Page 62: koding LOURDESHM

62

SISTEMA CONVERSION DE BASE

conversiones.php

<?php

echo "<center><h1>Sistema de conversion de Base</h1>";

echo "<br><hr><br>";

?>

<form action="?" method="post">

Numero: <input type="text" name="num" size="6"><br>

Base a convertir:

<select name="bases">

<option value="">Seleccione una base </option>

<option value="1">Decimal -> Binario </option>

<option value="2">Binario -> Decimal </option>

<option value="3">Decimal -> Octal </option>

<option value="4">Octal -> Decimal </option>

<option value="5">Decimal -> Hexadecimal </option>

<option value="6">HexaDecimal -> Decimal </option>

<option value="7">Binario -> Octal</option>

<option value="8">Octal -> Binario </option>

<option value="9">Binario -> Hexadecimal </option>

<option value="10">Hexadecimal -> Binario </option>

<option value="11">Octal -> Hexadecimal </option>

<option value="12">HexaDecimal -> Octal </option>

</select><br>

<input type="submit" name="convierte" value=" C o n v e r t i r ">

<br>

<?php

if (isset($_REQUEST['convierte'])){

echo "<h2>Sistema de Conversion de Base </h2>";

Page 63: koding LOURDESHM

63

echo "<hr>";

$opc=$_POST['bases'];

$num=$_POST['num'];

switch ($opc){

case "1": echo "Decimal a Binario = ".$num."<sub>10</sub> -->".DecBin($num)."<sub>2</sub><br>";

break;

case "2": echo "Binario a Decimal = ".$num."<sub>2</sub> -->".BinDec($num)."<sub>10</sub><br>";

break;

case "3": echo "Decimal a Octal = ".$num."<sub>10</sub> -->".DecOct($num)."<sub>8</sub><br>";

break;

case "4": echo "Octal a Decimal = ".$num."<sub>8</sub> -->".OctDec($num)."<sub>10</sub><br>";

break;

case "5": echo "Decimal a Hexadecimal = ".$num."<sub>10</sub> -->".DecHex($num)."<sub>16</sub><br>";

break;

case "6": echo "Hexadecimal a Decimal = ".$num."<sub>16</sub> -->".HexDec($num)."<sub>10</sub><br>";

break;

case "7": $a=BinDec($num);

echo "Binario a Octal = ".$num."<sub>2</sub> -->".DecOct($a)."<sub>8</sub><br>";

break;

case "8": $a=OctDec($num);

echo "Octal a Binario = ".$num."<sub>8</sub> -->".DecBin($a)."<sub>2</sub><br>";

break;

case "9": $a=BinDec($num);

echo "Binario a Hexadecimal = ".$num."<sub>2</sub> -->".DecHex($a)."<sub>16</sub><br>";

Page 64: koding LOURDESHM

64

break;

case "10": $a=HexDec($num);

echo "Hexadecimal a Binario = ".$num."<sub>16</sub> -->".DecBin($a)."<sub>2</sub><br>";

break;

case "11": $a=OctDec($num);

echo "Octal a Hexadecimal = ".$num."<sub>8</sub> -->".DecHex($a)."<sub>16</sub><br>";

break;

case "12": $a=HexDec($num);

echo "Hexadecimal a Octal = ".$num."<sub>16</sub> -->".DecOct($a)."<sub>2</sub><br>";

break;

}

echo "<hr>";

}

?>

Page 65: koding LOURDESHM

65

Page 66: koding LOURDESHM

66

Page 67: koding LOURDESHM

67

SISTEMA DE CONVERSIONESconversiones1.html

<html>

<center>

<h1>Sistema de conversiones</h1>

<p><hr><p>

<h3>

<form action="conversiones1.php" method="post">

Numero:

<input type="text" name="numero" size=8><p>

Base a convertir:

<select name="bases">

<option value="1002">Decimal => Binario</option>

<option value="0210">Binario => Decimal</option>

<option value="1008">Decimal => Octal</option>

<option value="0810">Octal => Decimal</option>

<option value="1016">Decimal => Hexadecimal</option>

<option value="1610">Hexadecimal => Decimal</option>

</select>

<p><hr><p>

<input type="submit" value="Convertir">

</form>

</h3>

</center>

</html>

Page 68: koding LOURDESHM

68

conversiones1.php

<html>

<head><title>Sistema de conversiones...</title></head>

<center>

<body>

<h1>Sistema de conversiones</h1>

<p><hr><p>

<h3>

El resultado de la conversion es:<p>

<?php

$bases=$_POST['bases'];

$numero=$_POST['numero'];

$origen=substr($bases,0,2);

$destino=substr($bases,2,2);

$num_convertido=base_convert($numero,$origen,$destino);

echo $numero."<sub>".$origen."</sub =>".$num_convertido."<sub>".$destino."</sub>";

?>

<p><hr><p>

<a href="conversion.html"><img src="flecha.jpg"></a>

</h3>

</body>

</html>

Page 69: koding LOURDESHM

69

Page 70: koding LOURDESHM

70

Page 71: koding LOURDESHM

71

Page 72: koding LOURDESHM

72

Page 73: koding LOURDESHM

73

Page 74: koding LOURDESHM

74

Page 75: koding LOURDESHM

75

Page 76: koding LOURDESHM

76

Page 77: koding LOURDESHM

77

Page 78: koding LOURDESHM

78

Page 79: koding LOURDESHM

79

Page 80: koding LOURDESHM

80

Page 81: koding LOURDESHM

81

Page 82: koding LOURDESHM

82

Page 83: koding LOURDESHM

83

Page 84: koding LOURDESHM

84

Page 85: koding LOURDESHM

85

CONSULTAS EN PHP

Page 86: koding LOURDESHM

86

Select periodo,count(*) form ambiente group by periodo limit 0,30

Page 87: koding LOURDESHM

87

select area,count(*) as noencuesta from ambiente where periodo="20121" group by area;

Page 88: koding LOURDESHM

88

select nombre_area, COUNT(*) AS ne from areas AS a,ambiente AS am where a.area = am.area and periodo ="20121" group by nombre_area limit 0,30;

Page 89: koding LOURDESHM

89

select avg(p11), avg(p11), avg(p12), avg(p13), avg(p14), avg(p15), avg(p16), avg(p17), avg(p18), avg(p19) from ambiente, areas where nombre_area="Directivos";

Page 90: koding LOURDESHM

90