RESUELTO – Conectar a VMware VCenter desde OSX (Mac)

¿Cuál es la forma más sencilla de conectarte a VCenter desde tu Mac? Sigue los pasos del post para instalar VirtualBox y una máquina virtual Windows, después inicia la máquina virtual recién instalada, abre un navegador web, conéctate a tu VCenter y descarga e instala el cliente VMware.

Conectar a Vcenter en Mac (OSX)

Una vez lo hayas hecho, toma un snapshot (instantánea) de tu máquina en VirtualBox. Asi siempre tendrás una instantánea con el cliente vmware instalado, lista para funcionar.

Fácil y ¡gratis!

RESUELTO – Internet Explorer (IE7, IE8, IE9, IE10, IE11) en MAC (OS X)

Muchas veces nos vemos en la obligación de probar cómo se ve una web en Internet Explorer. Inexplicablemente, todavía hay muchos usuarios que emplean Internet Explorer en sus versiones más antiguas (IE6, IE7, IE8, IE9), pese a las obvias desventajas de elegir este navegador.

Internet Explorer en MAC OSX

Desde Windows resulta más sencillo. Pero, ¿cómo ejecutar Internet Explorer desde tu OS X (Mac)?

La solución es sencilla:

1. Instala VirtualBox (descargar el instalador de VirtualBox para OSX)

2. Decide qué versiones de IE quieres instalar, abre Terminal y escribe el comando adecuado en función a la versión que desees *
— Todas las versiones de IE (crearás tantas máquinas virtuales como versiones de IE se instalen)

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | bash

— Internet Explorer 7 (IE7):

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="7" bash

— Internet Explorer (IE8):

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="8" bash

— Internet Explorer (IE9):

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="9" bash

— Internet Explorer (IE10):

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="10" bash

— Internet Explorer (IE11):

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="11" bash

3. Abre VirtualBox (lo tendrás instalado en “Aplicaciones” > “Virtual Box”) e inicia la máquina virtual adecuada. Se iniciará Windows y tendrás la versión de Internet Explorer que elegiste disponible. Recuerda que la contraseña por defecto de Windows es “Password1”.
Además, puedes realizar un snapshot de las máquinas para “solventar” el problema de la licencia de evaluación de 30 días que Microsoft aplica a su SO. Crea un snapshot nada más instalar las máquinas virtuales y arráncalo. Asi siempre tendrás tus 30 días de evaluación restantes.

Internet Explorer en Mac (resuelto)

* Los comandos del paso 2 son parte del ievsms script de xdissent y se encargan del proceso completo de descarga, conversión e instalación. Más fácil no puede ser 🙂

Nota: Si las URL’s de arriba no funcionan correctamente, puede ser que github haya cambiado la estructura de URL’s de raw.github.com a raw.githubusercontent.com. Corrige las URL’s superiores según este patrón.

Z39.50 command line client: YAZ CLIENT

YAZ-CLIENT is a useful command line Z39.50 client. You can install it with apt-get in your Debian box.

Connecting to Z39.50 server

You can connect to your server prividing IP Address/Port Number/Database name.
For instance I am going to connect to host=roble.unizar.es, port=210, database name=INNOPAC:

root@invenio1:~# yaz-client 
Z> open tcp:roble.unizar.es:210/INNOPAC
Connecting...OK.
Sent initrequest.
Connection accepted by v2 target.
ID     : Z39.50-III
Name   : z39-innopac
Version: 1
UserInformationfield:
{
    OCTETSTRING(len=52) Innovative Interfaces Inc. Z39.50 SERVER version 1.1
}
Guessing visiblestring:
'Innovative Interfaces Inc. Z39.50 SERVER version 1.1'
Options: search present scan namedResultSets
Elapsed: 0.178681

Getting server information

Z> list_all
Connected to         : tcp:roble.unizar.es:210/INNOPAC
auto_reconnect       : off
auto_wait            : on
Authentication       : none
Bases                : INNOPAC 
CCL file             : default.bib
CQL file             : /usr/local/share/yaz/etc/pqf.properties
Query type           : prefix (RPN sent to server)
Named Result Sets    : on
ssub/lslb/mspn       : 0/1/0
Format               : usmarc
Schema               : not set
Elements             : 
APDU log             : off
Record log           : off
Other Info:

Making a query

I am going to search records with title='”Aiche Journal” (more details on how to search by typing: man yaz-client)

Z> f @attr 1=4 "Aiche journal"
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 3, setno 1
records returned: 0
Elapsed: 0.056104

And listing results:

 

Z> show 1
Sent presentRequest (1+1).
Records: 1
[INNOPAC]Record type: USmarc
00976nas 2200253 i 4500
001 ocm00000001-1541
008 750720c19559999us mr p i 0 a0eng d
022 $a 0001-1541
022 $a 1547-5905 $b (Online)
040 $a UZ.PPE
080 $a (051)66
210 1 $a AICHE J.
222 0 $a AICHE journal $b (Print)
222 0 $a AICHE journal $b (Online)
245 00 $a AICHE journal : $b American Institute of Chemical Engineers journal / $c American Institute of Chemical Engineers.
246 13 $a American Institute of Chemical Engineers journal.
260 $a New York : $b American Institute of Chemical Engineers, $c 1955-
300 $a v. : $b il. ; $c 29 cm.
310 $a Mensual.
321 $a Trimestral $b (Mar. 1955-June 1957)
321 $a Bimestral $b (Jan. 1975-1995)
500 $a Indices de autor, t?itulo y materias de cada volumen en el ?ultimo n?umero del volumen.
650 04 $a Ingenier?ia qu?imica $v Publicaciones peri?odicas.
710 2 $a American Institute of Chemical Engineers.

nextResultSetPosition = 2
Elapsed: 0.201121

Next result…

Z> show 2
Sent presentRequest (2+1).
Records: 1
[INNOPAC]Record type: USmarc
00976nas  2200253 i 4500
001 ocm00000001-1541
008 750720c19559999us mr p  i    0   a0eng d
022    $a 0001-1541
022    $a 1547-5905 $b (Online)  
040    $a UZ.PPE
080    $a (051)66
210 1  $a AICHE J.
222  0 $a AICHE journal $b (Print)
222  0 $a AICHE journal $b (Online)
245 00 $a AICHE journal : $b American Institute of Chemical Engineers journal  / $c American Institute of Chemical Engineers.
246 13 $a American Institute of Chemical Engineers journal.
260    $a New York : $b American Institute of Chemical Engineers, $c 1955-
300    $a v. : $b il. ; $c 29 cm.
310    $a Mensual.
321    $a Trimestral $b (Mar. 1955-June 1957)
321    $a Bimestral $b (Jan. 1975-1995)
500    $a Indices de autor, t?itulo y materias de cada volumen en el ?ultimo n?umero del volumen.
650 04 $a Ingenier?ia qu?imica $v Publicaciones peri?odicas.
710 2  $a American Institute of Chemical Engineers.
 
nextResultSetPosition = 3
Elapsed: 0.013234

Using your III WebOPAC to show holding information

This will be useful if you have Innovative Millenium WebPAC.
You can show record’s holding data using b number.

For instance for record with .b1000203
HOLDINGS (english): http://roble.unizar.es/search?/.b1000203/.b1000203/1%2C1%2C1%2CB/holdings~b1000203
HOLDINGS (español): http://roble.unizar.es/search*spi?/.b1000203/.b1000203/1%2C1%2C1%2CB/holdings~b1000203
LOANS: AVAILABILTY INFORMATION: http://roble.unizar.es/search?/.b1000203/.b1000203/1%2C1%2C1%2CB/request~b1000203

Duplicate VIEWS in MySQL [SOLVED]

MySQL views are stored in information_schema.views table. You can list your views:

mysql> USE information_schema;
mysql> DESCRIBE views;
+-----------------+--------------+------+-----+---------+-------+
| FIELD           | TYPE         | NULL | KEY | DEFAULT | Extra |
+-----------------+--------------+------+-----+---------+-------+
| TABLE_CATALOG   | VARCHAR(512) | YES  |     | NULL    |       | 
| TABLE_SCHEMA    | VARCHAR(64)  | NO   |     |         |       | 
| TABLE_NAME      | VARCHAR(64)  | NO   |     |         |       | 
| VIEW_DEFINITION | longtext     | NO   |     | NULL    |       | 
| CHECK_OPTION    | VARCHAR(8)   | NO   |     |         |       | 
| IS_UPDATABLE    | VARCHAR(3)   | NO   |     |         |       | 
| DEFINER         | VARCHAR(77)  | NO   |     |         |       | 
| SECURITY_TYPE   | VARCHAR(7)   | NO   |     |         |       | 
+-----------------+--------------+------+-----+---------+-------+
8 ROWS IN SET (0.00 sec)
 
mysql> SELECT TABLE_NAME FROM views;
+---------------------------+
| TABLE_NAME                |
+---------------------------+
| uz_DOWNLOADS_TESIS        | 
| uz_DOWNLOADS_TESIS_TITLES | 
| uz_REGISTROS_BORRADOS     | 
+---------------------------+
3 ROWS IN SET, 5 warnings (0.11 sec)

You can also view who defined each view (DEFINER):

mysql> SELECT TABLE_NAME, definer FROM views;
+---------------------------+--------------------+
| TABLE_NAME                | definer            |
+---------------------------+--------------------+
| uz_DOWNLOADS_TESIS        | root@155.210.85.31 | 
| uz_DOWNLOADS_TESIS_TITLES | root@155.210.85.31 | 
| uz_REGISTROS_BORRADOS     | root@155.210.85.31 | 
+---------------------------+--------------------+
3 ROWS IN SET, 5 warnings (0.11 sec)

And you can also get the query for a view:

mysql> SELECT TABLE_NAME, view_definition FROM views;
| uz_DOWNLOADS_TESIS        | /* ALGORITHM=UNDEFINED */ (SELECT `cdsinvenio`.`rnkDOWNLOADS`.`id_bibrec` AS `id_bibrec`,`cdsinvenio`.`rnkDOWNLOADS`.`download_time` AS `download_time`,`cdsinvenio`.`rnkDOWNLOADS`.`client_host` AS `client_host`,`cdsinvenio`.`rnkDOWNLOADS`.`id_user` AS `id_user`,`cdsinvenio`.`rnkDOWNLOADS`.`id_bibdoc` AS `id_bibdoc`,`cdsinvenio`.`rnkDOWNLOADS`.`file_version` AS `file_version`,`cdsinvenio`.`rnkDOWNLOADS`.`file_format` AS `file_format`,COUNT(`cdsinvenio`.`rnkDOWNLOADS`.`id_bibrec`) AS `total` FROM `cdsinvenio`.`rnkDOWNLOADS` WHERE (`cdsinvenio`.`rnkDOWNLOADS`.`id_bibrec` IN (SELECT DISTINCT `cdsinvenio`.`bibrec_bib98x`.`id_bibrec` AS `id_bibrec` FROM `cdsinvenio`.`bibrec_bib98x` WHERE (`cdsinvenio`.`bibrec_bib98x`.`id_bibxxx` = 7)) AND (NOT(`cdsinvenio`.`rnkDOWNLOADS`.`id_bibrec` IN (SELECT DISTINCT `cdsinvenio`.`bibrec_bib98x`.`id_bibrec` AS `id_bibrec` FROM `cdsinvenio`.`bibrec_bib98x` WHERE (`cdsinvenio`.`bibrec_bib98x`.`id_bibxxx` = 3))))) GROUP BY `cdsinvenio`.`rnkDOWNLOADS`.`id_bibrec`) | 
| uz_DOWNLOADS_TESIS_TITLES | /* ALGORITHM=UNDEFINED */ (SELECT `cdsinvenio`.`bibrec_bib24x`.`id_bibrec` AS `id_bibrec`,`cdsinvenio`.`bib24x`.`value` AS `value`,`uz_DOWNLOADS_TESIS`.`total` AS `total` FROM `cdsinvenio`.`bib24x` JOIN `cdsinvenio`.`bibrec_bib24x` JOIN `cdsinvenio`.`uz_DOWNLOADS_TESIS` WHERE ((`cdsinvenio`.`bib24x`.`id` = `cdsinvenio`.`bibrec_bib24x`.`id_bibxxx`) AND (`cdsinvenio`.`bibrec_bib24x`.`id_bibrec` = `uz_DOWNLOADS_TESIS`.`id_bibrec`) AND (`cdsinvenio`.`bib24x`.`tag` = _utf8'24500a')) ORDER BY `cdsinvenio`.`bibrec_bib24x`.`id_bibrec`)
| uz_REGISTROS_BORRADOS     | /* ALGORITHM=UNDEFINED */ (SELECT DISTINCT `cdsinvenio`.`bibrec_bib98x`.`id_bibrec` AS `id_bibrec` FROM `cdsinvenio`.`bibrec_bib98x` WHERE (`cdsinvenio`.`bibrec_bib98x`.`id_bibxxx` = 3))

Knowing the query you can re-create the view with another name in another database. Original datbase was cdsinvenio, cloned database is invenio2014

mysql> USE invenio2014;
mysql> CREATE VIEW UZ_DESCARGAS_TESIS AS (SELECT `invenio2014`.`rnkDOWNLOADS`.`id_bibrec` AS `id_bibrec`,`invenio2014`.`rnkDOWNLOADS`.`download_time` AS `download_time`,`invenio2014`.`rnkDOWNLOADS`.`client_host` AS `client_host`,`invenio2014`.`rnkDOWNLOADS`.`id_user` AS `id_user`,`invenio2014`.`rnkDOWNLOADS`.`id_bibdoc` AS `id_bibdoc`,`invenio2014`.`rnkDOWNLOADS`.`file_version` AS `file_version`,`invenio2014`.`rnkDOWNLOADS`.`file_format` AS `file_format`,COUNT(`invenio2014`.`rnkDOWNLOADS`.`id_bibrec`) AS `total` FROM `invenio2014`.`rnkDOWNLOADS` WHERE (`invenio2014`.`rnkDOWNLOADS`.`id_bibrec` IN (SELECT DISTINCT `invenio2014`.`bibrec_bib98x`.`id_bibrec` AS `id_bibrec` FROM `invenio2014`.`bibrec_bib98x` WHERE (`invenio2014`.`bibrec_bib98x`.`id_bibxxx` = 7)) AND (NOT(`invenio2014`.`rnkDOWNLOADS`.`id_bibrec` IN (SELECT DISTINCT `invenio2014`.`bibrec_bib98x`.`id_bibrec` AS `id_bibrec` FROM `invenio2014`.`bibrec_bib98x` WHERE (`invenio2014`.`bibrec_bib98x`.`id_bibxxx` = 3))))) GROUP BY `invenio2014`.`rnkDOWNLOADS`.`id_bibrec`)

And to delete a view, you can do it like:

mysql> DROP VIEW uz_DOWNLOADS_TESIS;
Query OK, 0 ROWS affected (0.05 sec)

Install DISTCACHE on RHEL6 [SOLVED]

Installing distcache on RHEL6 can be tricky. Let’s see how to do it…

cd /home/miguelm/invenio113/prerequisites/distcache
wget http://sourceforge.net/projects/distcache/files/latest/download?source=files
tar -xzvf distcache-1.5.1.tar.gz
cd distcache-1.5.1

If you try to compile as is, you will get errors:

proto_fd.c: In function 'addr_parse':
proto_fd.c:177: error: 'LONG_MIN' undeclared (first use in this function)
proto_fd.c:177: error: (Each undeclared identifier is reported only once
proto_fd.c:177: error: for each function it appears in.)
proto_fd.c:177: error: 'LONG_MAX' undeclared (first use in this function)

To get rid of them, you just have to include in distcache-1.5.1/libnal/proto_fd.c as in:

#define SYS_GENERATING_LIB
 
#include <libsys/pre.h>
#include <libnal/nal.h>
#include "nal_internal.h" 
#include "ctrl_fd.h" 
#include <libsys/post.h>
#include <limits.h>
 
/**************************/
/* predeclare our vtables */
/**************************/
...

Now you can compile with no errors…

./configure --prefix=/usr
make
make install

Rename multiple files using sequence number in OSX from command line [SOLVED]

With this command you will rename all the jpg files in the current directory to PREFIX_0000.jpg to PREFIX_9999.jpg

find . -name '*.jpg' \
| awk 'BEGIN{ a=0 }{ printf "mv %s PREFIX_%04d.jpg\n", $0, a++ }' \
| bash

If you just need two numbers (PREFIX_00.jpg to PREFIX_99.jpg) you can do it by:

find . -name '*.jpg' \
| awk 'BEGIN{ a=0 }{ printf "mv %s PREFIX_%02d.jpg\n", $0, a++ }' \
| bash

CentOS Python crash after update: Urandom [SOLVED]

We updated our CentOS machines and when we restarted our Apache servers, and tried to access the sites, a “500 Internal Server Error” was being shown.

We noticed some ugly shit in Apache error.log:

ImportError: cannot import name urandom
[Tue Nov 27 11:45:17 2012] [error] make_obcallback: Python path being used "['/usr/lib64/python2.4/site-packages/setuptools-0.6c5-py2.4.egg', '/usr/lib64/python2.4/site-packages/rdflib-2.4.0-py2.4-linux-x86_64.egg', '/usr/lib64/python2.4/site-packages/cx_Oracle-5.0-py2.4-linux-x86_64.egg', '/usr/lib64/python2.4/site-packages/MySQL_python-1.2.2-py2.4-linux-x86_64.egg', '/usr/lib/python2.4/site-packages/pylint-0.18.1-py2.4.egg', '/usr/lib/python2.4/site-packages/logilab_astng-0.19.1-py2.4.egg', '/usr/lib/python2.4/site-packages/logilab_common-0.44.0-py2.4.egg', '/usr/lib/python2.4/site-packages/pysnmp_apps-0.2.9a-py2.4.egg', '/usr/lib/python2.4/site-packages/pysnmp-4.1.13a-py2.4.egg', '/usr/lib/python2.4/site-packages/pyasn1-0.0.11a-py2.4.egg', '/usr/lib64/python24.zip', '/usr/lib64/python2.4', '/usr/lib64/python2.4/plat-linux2', '/usr/lib64/python2.4/lib-tk', '/usr/lib64/python2.4/lib-dynload', '/usr/lib64/python2.4/site-packages', '/usr/lib64/python2.4/site-packages/Numeric', '/usr/lib64/python2.4/site-packages/gtk-2.0', '/usr/lib/python2.4/site-packages']".
[Tue Nov 27 11:45:17 2012] [error] get_interpreter: no interpreter callback found.

To fix this, you must check the following:

[root@aneto ~]# rpm -q mod_python
mod_python-3.2.8-3.1
[root@aneto ~]# rpm -q httpd
httpd-2.2.3-65.el5_8.3
[root@aneto ~]# rpm -q python
python-2.4.3-46.el5_8.2

If the output is like the one above, then run:

[root@aneto ~]# yum downgrade python python-libs

And then restart Apache. Issues should be now fixed.

Editor VI: Sustituir todas las ocurrencias de una palabra (buscar y reemplazar) – RESUELTO

Una de las operaciones más habituales consiste en buscar y reemplazar las ocurrencias de una palabra/frase en un archivo de texto. Esto es muy sencillo utilizando editores, o incluso haciéndolo mediante línea de comandos, pero ¿cómo hacerlo directamente desde el editor VI?

Veámoslo con un ejemplo:

Para sustituir todas las ocurrencias de record[pos_doi] por record["doi"]:

:%s/record\[pos_doi\]/record["doi"]/g

OS X y cliente SAMBA para conectar a disco usb de LIVEBOX Orange [Resuelto]

Una de las cosas que menos me ha gustado del proceso de migración a OS X ha sido que el sistema no permita conectarse a servidores samba.

Si, como yo, tenéis un router Livebox de Orange, podéis conectar un disco duro o pendrive a él y verlo desde todos los ordenadores de la casa… que no ejecuten OS X. Simplemente tendréis que ir al navegador y poner \\Livebox\ (Windows) o smb:\\Livebox\ para los MAC anteriores.

Si el disco está en NFTS solo se podrá leer. Para que pueda leerse y escribirse deberá estar en FAT32.

Vamos a ver cómo hacer que se vean también en OS X. Para ello vamos a levantar el servicio samba instalando el donationware SMBup.

Con esta aplicación se realizarán los cambios necesarios en el sistema para que puedas ver tus discos montados con SMB (como el que hayas conectado al router Livebox de Orange). El software, además, te permite deshacer todo el proceso, si lo deseas hacer en algún momento.

¡No os olvidéis de donar algo! 🙂