El otro día anduve necesitando una base de datos con provincias, departamentos y localidades Argentinas y buscando en la web no pude encontrar nada decente, así que me puse a buscar y compilar la data de diversas fuentes en Internet y al final logré una base de datos MySQL bastante interesante (teniendo en cuenta, como dije anteriormente, que no había nada bien armado y listo para usar).
Sin más, voy a describir las tablas y la data que contiene cada una:
1) provincias:
id: campo numérico del 1 al 24 para las 24 provincias Argentinas
ISO_3166-2: códigos ISO 3166-2:AR, para mas info ver http://es.wikipedia.org/wiki/ISO_3166-2:AR
ISO_3166-2_letra: sólo la letra del código ISO 3166-2:AR
nombre: el nombre de cada provincia
superficie: la superficie de la provincia, es un campo numérico expresado en kilómetros cuadrados
2) departamentos:
id: campo numérico autoincremental para identificar cada departamento
id_provincia: campo numérico relacionado con el id de la provincia (en la tabla provincias)
nombre: el nombre del departamento en cuestión
superficie: la superficie del departamento, es un campo numérico expresado en kilómetros cuadrados
3) comunas_ciudad_de_buenos_aires:
id: en la Ciudad de Buenos Aires los "departamentos" son llamados "comunas" numeradas del 1 al 15 y cada
una esta compuesta por varios barrios, así que este campo numérico es el número de la comuna
barrio: el nombre del barrio, y como aclaración nuevamente, puede haber varios barrios dentro de un número de comuna determinado
4) localidades:
id: campo numérico autoincremental para identificar cada localidad
id_provincia: campo numérico relacionado con el id de la provincia (en la tabla provincias)
nombre: el nombre de cada localidad
codigo_postal: el código postal correspondiente a la localidad (el viejo, no el CPA)
Listo con la explicación de las tablas !
Ahora, algunas aclaraciones:
- TODOS LOS DATOS fueron compilados de fuentes públicas gubernamentales, así que estimo con casi total seguridad que son de dominio público, ya que se pagan con los impuestos de todos los Argentinos.
- Por supuesto, no proporciono garantía alguna de que esta base de datos contenga información fidedigna ni correcta. Simplemente hice mi mejor trabajo con la data que disponía, nada más. Tampoco proporciono ningún otro tipo de garantía sobre esta base de datos (por si quedaba alguna duda).
- Departamentos, Partidos y Comunas se refieren a la misma cosa. Se denominan departamentos en todas las provincias del País, menos en la provincia de Buenos Aires y la Ciudad de Buenos Aires (que se considera una provincia separada), en cuyos casos se denominan Partidos y Comunas respectivamente.
- La razón de que la Ciudad de Buenos Aires no entre en la tabla "departamentos" es por el punto expuesto anteriormente, ya que está dividida de manera diferente al resto del País, así que opté por utilizar otra tabla separada (no le veo otra solución además).
- La superficie de la Provincia de Tierra del Fuego es la superficie combinada de la "Isla Grande de Tierra del Fuego" y "Tierra del Fuego, Antártida e Islas de Atlántico Sur" (21.263 km² + 1.002.445 km²).
Y acá va el link para bajarla, es un sencillo dump que se puede importar con phpMyAdmin o via consola:
BAJAR BASE DE DATOS DE DIVISION TERRITORIAL ARGENTINA
Espero que resulte útil. Con un simple comentario ayuda para ver si sirvió o no ;-)
Saludos !
Thursday, December 20, 2012
Wednesday, July 4, 2012
Create /dev/parport0 on Debian Squeeze
It seems Debian Squeeze doesn't create the /dev/parport0 device by default, so in order to create it you have to manually run (as root):
Also, you need to have loaded the parport_pc module, which you can load with:
Cheers !
mknod /dev/parport0 c 99 0
chmod a+rw /dev/parport0
Also, you need to have loaded the parport_pc module, which you can load with:
modprobe parport_pc
Cheers !
Wednesday, February 29, 2012
How to run Acronis Alignment Tool (WD Align) from a pendrive or USB drive
I'll make it quick:
Download RMPrepUSB, then format the pendrive as FAT32. Within RMPrepUSB install grub4dos on the pendrive.
Then copy the ISO the acronis program generated to the root of the pendrive.
Now, boot the pendrive and in the grub console just type (rename acronis_boot.iso to whatever you have named your ISO):
This maps (or copy) the ISO to RAM and run the ISO from there. You can go without the --mem but the program crashed without it being ran on RAM.
Cheers
Download RMPrepUSB, then format the pendrive as FAT32. Within RMPrepUSB install grub4dos on the pendrive.
Then copy the ISO the acronis program generated to the root of the pendrive.
Now, boot the pendrive and in the grub console just type (rename acronis_boot.iso to whatever you have named your ISO):
map --mem (hd0,0)/acronis_boot.iso (hd32)
map --hook
chainloader (hd32)
boot
This maps (or copy) the ISO to RAM and run the ISO from there. You can go without the --mem but the program crashed without it being ran on RAM.
Cheers
Tuesday, February 21, 2012
PHP exec() function hangs when running external program in the background
Well, this was a case of not reading the PHP documentation, because it clearly states that:
"If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends."
So, normally when you run a program with exec(), it finishes it's normal execution and you're good, but if you are trying to run something in the background (like creating an ssh tunnel in my case) you need to redirect it's output (stdout and stderr) to another file.
I solved it by adding this to my command:
Which redirects stdout to /dev/null and then redirects stderr to stdout (which goes to /dev/null) and then telling the command to run in the background with the ampersand.
Done ! exec() doesn't hang anymore ;-)
Carlos
"If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends."
So, normally when you run a program with exec(), it finishes it's normal execution and you're good, but if you are trying to run something in the background (like creating an ssh tunnel in my case) you need to redirect it's output (stdout and stderr) to another file.
I solved it by adding this to my command:
> /dev/null 2>&1 &
Which redirects stdout to /dev/null and then redirects stderr to stdout (which goes to /dev/null) and then telling the command to run in the background with the ampersand.
Done ! exec() doesn't hang anymore ;-)
Carlos
Thursday, February 2, 2012
Configure Belkin F5D7050 / F5D7050B on Debian Squeeze (and possibly Ubuntu too)
You just need to add the "non-free" component to /etc/apt/sources.list like this:
# Debian Squeeze/6.0
deb http://ftp.us.debian.org/debian squeeze main contrib non-free
# Debian Lenny/5.0
deb http://ftp.us.debian.org/debian lenny main contrib non-free
Then do an update and install a couple packages:
apt-get update
apt-get install firmware-ralink wireless-tools
And without blacklisting the rt2500usb module I couldn't make my adapter to work (it seems this module should not be autoloaded for some reason, don't know why exactly), so the last step is modifying /etc/modprobe.d/blacklist.conf and add:
blacklist rt2500usb
Save the file, remove and plug again your adapter, or reboot if nothing seem to help at this point.
Your Belkin adapter should be working now and you should see it with an iwconfig.
Carlos
# Debian Squeeze/6.0
deb http://ftp.us.debian.org/debian squeeze main contrib non-free
# Debian Lenny/5.0
deb http://ftp.us.debian.org/debian lenny main contrib non-free
Then do an update and install a couple packages:
apt-get update
apt-get install firmware-ralink wireless-tools
And without blacklisting the rt2500usb module I couldn't make my adapter to work (it seems this module should not be autoloaded for some reason, don't know why exactly), so the last step is modifying /etc/modprobe.d/blacklist.conf and add:
blacklist rt2500usb
Save the file, remove and plug again your adapter, or reboot if nothing seem to help at this point.
Your Belkin adapter should be working now and you should see it with an iwconfig.
Carlos
Wednesday, January 18, 2012
Cut or remove comments from a file with grep on linux
I needed to remove the comments and blank lines to cleanup a config file (namely, the squid.conf file which had a thousand comments).
The -v flag negates the search and the -e flag uses a regex to do the search. I just happened to have used just two regexes on this particular line, but feel free to use as many as you need on your file.
I found this line to be very useful as I'm working with config files all day and sometimes, mostly when I actually know what I'm doing and don't need any references, I want those config files to be cleaned up to be easier on the eyes ;-)
Carlos
grep -ve '^#' -ve '^$' squid.conf
The -v flag negates the search and the -e flag uses a regex to do the search. I just happened to have used just two regexes on this particular line, but feel free to use as many as you need on your file.
I found this line to be very useful as I'm working with config files all day and sometimes, mostly when I actually know what I'm doing and don't need any references, I want those config files to be cleaned up to be easier on the eyes ;-)
Carlos
Subscribe to:
Posts (Atom)
Followers
About me
- coke
- Santa Fe, Argentina
- Programador Web, PHP, MySQL, JQuery, Administrador Linux. LAMP, Lighttpd, Nginx.