TU ANUNCIO / YOUR PUBLICITY

AQUÍ PODRÍA ESTAR TU ANUNCIO: / HERE COULD BE YOUR AD E-mail

domingo, 27 de abril de 2014

How to georeference photo files / Cómo georeferenciar archivos fotográficos


1º Instalamos lo necesario:
root@ordenata:~$ apt-get install geotiff-bin

El comando más habitual es:

geotipcp -e archivo.tfw origen.tif destino.tif

Las instrucciones son:

usage: gtiffcp [options] input... output
where options are:
-g file install GeoTIFF metadata from <file>
-4 proj4_str install GeoTIFF metadata from proj4 string
-e file install positioning info from ESRI Worldfile <file>
-a append to output instead of overwriting
-o offset set initial directory offset
-p contig pack samples contiguously (e.g. RGBRGB...)
-p separate store samples separately (e.g. RRR...GGG...BBB...)
-s write output in strips
-t write output in tiles
-i ignore read errors
-d truncate 8 bitspersample to 4bitspersample

-r # make each strip have no more than # rows
-w # set output tile width (pixels)
-l # set output tile length (pixels)

-f lsb2msb force lsb-to-msb FillOrder for output
-f msb2lsb force msb-to-lsb FillOrder for output

-c lzw[:opts] compress output with Lempel-Ziv & Welch encoding
-c zip[:opts] compress output with deflate encoding
-c jpeg[:opts]compress output with JPEG encoding
-c packbits compress output with packbits encoding
-c g3[:opts] compress output with CCITT Group 3 encoding
-c g4 compress output with CCITT Group 4 encoding
-c none use no compression algorithm on output

Group 3 options:
1d use default CCITT Group 3 1D-encoding
2d use optional CCITT Group 3 2D-encoding
fill byte-align EOL codes
For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs

JPEG options:
# set compression quality level (0-100, default 75)
r output color image as RGB rather than YCbCr
For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality

LZW and deflate options:
# set predictor value
For example, -c lzw:2 to get LZW-encoded data with horizontal differencing

Y un ejemplo de archivo.tfw sería:

0.0096628
0.00257495
0.00257495
-0.0096628
618251.334935
4849230.18706

es decir:


|Vx1, Vx2| es el tamaño del pixel en la dirección x
|Vy1, Vy2| es el tamaño del pixel en la dirección y
Px, Py son las coordenadas del punto de origen.

domingo, 20 de abril de 2014

Instalation and first steps with POSTGRES / Instalación y primeros pasos con POSTGRES

1º Instalamos lo necesario: / Instaling
root@ordenata:~$ apt-get install apache2 php5 postgresql php5-pg*

→ Apache
→ php5
→ postgresql
→ las librerías de php5 de postgresql.

2º Como el super-usuario “postgresql” es muy dificil de tratar desde php se crea otro igual de super-usuario:
2nd As the super-user "postgresql" is very difficult to treat from php, create another super-user:

sudo -u postgres createuserb -EP usuario3
Introduzca la contraseña para el nuevo rol: tralara
Introdúzcala nuevamente: tralara
¿Será el nuevo rol un superusuario? (s/n) s

3º Crearemos una base de datos / We creare a DB.
root@ordenata:~$ su – postgres (desde root)
postgres@ordenata:~$ psql
psql (8.4.9) (esto aparececrá en la pantalla)
Digite «help» para obtener ayuda.

postgres=# create database arca ;
CREATE DATABASE
postgres=# \q
postgres@ordenata:~$ exit
logout

4º Desde apache-php / From apache-php

Archivo / file: "bd.php:"

<?php
$cona=pg_connect("host=localhost dbname=arca user=usuario3 password=tralara");
$sel=pg_query($cona,"CREATE TABLE tabla1(uno int, dos int)");
$sel=pg_query($cona,"INSERT INTO tabla1(uno, dos) VALUES (34,55)");
?>
Desde un navegadorhttp://localhost/bd.php

5º Comprobemos:
postgres@ordenata:~$ psql arca
arca=# \l
Listado de base de datos
Nombre | Dueño | Codificación | Collation | Ctype | Privilegios
-----------+----------+--------------+-------------+-------------+-----------------------
arca | postgres | UTF8 | es_ES.UTF-8 | es_ES.UTF-8 |

arca=# \dt → public | tabla1 | tabla | usuario3

arca=# SELECT * FROM tabla1; → 34 | 55


MÁS DIFICIL TODAVÍA QUIERO CONECTARME DESDE OTRO ORDENADOR VIA WEB
STILL MORE DIFFICULT, I WANT TO CONNECT FROM ANOTHER REMOTE COMPUTER.

1º Se abre el fichero / We open  postgresql.conf:

sudo nano /etc/postgresql/8.4/main/postgresql.conf

y en una fila se escribe: / In a line we write

[…]
listen_addresses='*'
[…]

Cuando lo intentemos dará el siguiente error: We will have this error. No problem.

Unable to connect to PostgreSQL server: FATAL: no hay una l?nea en pg_hba.conf para ...

2aº Se abre pg_hba.conf y se escribe: (si nuestra ip es 77.209.54.169)
2aº Open pg_hba.conf and write: (if our ip is 77.209.54.169)

sudo nano /etc/postgresql/8.4/main/pg_hba.conf
[…]
hostnossl all all 77.209.54.169/24 md5
[…]

2bº Para toda internet posible (pero conociendo nuestra base de datos, “arca”, y nuestro usuario, “usuario3”:
2bº For all people

[…]
host arca usuario3 0.0.0.0 0.0.0.0 md5
[…]

3º El siguiente ejemplo funcionará (con una bd postgresql en 83.57.127.159 en la que previamente habremos redirigido el puerto 5432):


3º The next ejemple will work (with a db postgresql in 83.57.127.159 with the port 5432):
<?php
$cona=pg_connect("host=83.57.127.159 port=5432 dbname=arca user=usuario3 password=tralara");
$sel=pg_query($cona,"CREATE TABLE tabla3(uno int, dos int)");
$sel=pg_query($cona,"INSERT INTO tabla3(uno, dos) VALUES (343,355)");
?>

domingo, 13 de abril de 2014

Installing WIFI in laptops with LINUX / Cómo instalar la WIFI en portátiles con LINUX

1º Instalar el controlador
1. INstall the driver

sudo apt-get install firmware-b43-installer

2º Hacer que al iniciar linux lo adopte:
2nd Make when starting linux accepts:

sudo nano /etc/modules

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

lp
rtc
b43 ← se incorpora esta línea / Add this line.

3º Reiniciar el ordenador
3rd Restart computer

END

domingo, 6 de abril de 2014

Control of modified files with SAMBA / Control de archivos modificados vía SAMBA


En /etc/samba/samba.conf:

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = XXXX

######################################################################
# DATOS AÑADIDOS
vfs objects = full_audit
full_audit:prefix = %u|%I|%m|%S
#full_audit:success = mkdir rename unlink rmdir pwrite pread connect disconnect
full_audit:success = rename pwrite
full_audit:failure = none
full_audit:facility = LOCAL7
full_audit:priority = NOTICE
#FIN DATOS AÑADIDOS
######################################################################

# server string is the equivalent of the NT Description field
[…]

Luego se modifica donde esté LOCAL7 que está en /etc/rsyslog.d/50-default.conf:

# Default rules for rsyslog.
#
# For more information see rsyslog.conf(5) and /etc/rsyslog.conf
#SAMBA MODIFICADO:

local7.* /directorio/donde/guardar/datos/registro_de_movimiento_de_archivos.txt
[…]

Ejemplos en:


El registro (… registro_de_movimiento_de_archivos.txt ) que queda es del estilo...

Nov 2 15:10:50 usu smbd_audit: usu|192.168.1.69|__ffff_192.168.1.69|No|pwrite|ok|Fotos.pdf
Nov 2 15:11:22 usu smbd_audit: last message repeated 4795 times
Nov 2 15:14:41 usu smbd_audit: usu|192.168.1.35|otro|No|pwrite|ok|Diario.xls
Nov 2 15:26:38 usu smbd_audit: usu192.168.1.69|__ffff_192.168.1.69|Na|rename|ok|Gente/Asistencias/Inza|.Trash-1000/files/Inza
Nov 2 15:26:38 usu smbd_audit: usu|192.168.1.69|__ffff_192.168.1.69|No|pwrite|ok|.Trash-1000/info/Inza.trashinfo.U0OA4V
Nov 2 15:26:38 usu smbd_audit: usu|192.168.1.69|__ffff_192.168.1.69|No|rename|ok|.Trash-1000/info/Inza.trashinfo.U0OA4V|.Trash-
[…]


si recordamos la línea : full_audit:prefix = %u|%I|%m|%S

Nov 2 15:14:41 usu smbd_audit: obra|192.168.1.35|otro|No|pwrite|ok|Archivo

Dependerá, por tanto de lo que se defina en prefix la información que sea ordenada. El único punto débil es que el archivo de registro crecerá hasta el infinito si no tiene un sistema de borrado de datos viejos. Ésto se puede hacer a través de cron con la instrucción:

It will therefore depend on what the information is sorted in prefix defined. The only weak point is that the log file will grow to infinity if it has a system of deleting old data. This can be done via cron with the command:

echo “” > /directorio/donde/guardar/datos/registro_de_movimiento_de_archivos.txt