Introducing MARCXML manipulation tool

If you have to import/export your MARCXML records in Invenio, tind.io offers this great online utility: https://tools.tind.io/xml/xml-manipulation/ that allows to manipulate marcxml.

Marcxml manipulation tool tind.io

Exporting marc is not only useful on migration processes, but also when you have to perform changes to a lot of records in your Invenio system. It is way better than performing those changes at database level.

You can export records using web interface or command line. I prefer this second method, using BibExport:

First change this config file: /opt/invenio/etc/bibexport/marcxml.cfg

The MARCXML exporting method export all the records matching a particular search query, zip them and move them to the requested folder. The output of this exporting method is similar to what one would get by listing the records in MARCXML from the web search interface.

Default configurations are given below. The job would have exported all records from the Book collection into one xml.-file and all articles with the author “Polyakov, A M” into another.

[export_job]
export_method = marcxml
[export_criterias]
books = 980__a:BOOK
polyakov_articles = 980__a:ARTICLE and author:"Polyakov, A M"

the job is run by this command:

/opt/invenio/bin/bibexport -u admin -wmarcxml

Default folder for storing is:

/opt/invenio/var/www/export/marcxml

Invenio 1: BibRank exception

I was getting several exceptions in Bibrank:

* 2015-01-15 08:32:17 -> NoOptionError: No option 'citation_loss_limit' in section: 'citation' (ConfigParser.py:618:get)

** User details
No client information available

** Traceback details 

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/invenio/bibtask.py", line 606, in task_init
    ret = _task_run(task_run_fnc)
  File "/usr/lib64/python2.7/site-packages/invenio/bibtask.py", line 1146, in _task_run
    if callable(task_run_fnc) and task_run_fnc():
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank.py", line 159, in task_run_core
    func_object(key)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_tag_based_indexer.py", line 443, in citation
    return bibrank_engine(run)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_tag_based_indexer.py", line 356, in bibrank_engine
    func_object(rank_method_code, cfg_name, config)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_tag_based_indexer.py", line 68, in citation_exec
    dic, index_update_time = get_citation_weight(rank_method_code, config)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_citation_indexer.py", line 141, in get_citation_weight
    weights = process_and_store(updated_recids, config, chunk_size)
  File "/usr/lib64/python2.7/site-packages/invenio/bibrank_citation_indexer.py", line 157, in process_and_store
    citation_loss_limit = int(config.get(function, "citation_loss_limit"))
  File "/usr/lib64/python2.7/ConfigParser.py", line 618, in get
    raise NoOptionError(option, section)
NoOptionError: No option 'citation_loss_limit' in section: 'citation'

** Stack frame details

This was solved by updating /opt/invenio/etc/bibrank/citation.cfg with citation_loss_limit = 50 and I also included some more options:

[...]
reference_via_doi= 999C5a
reference_via_record_id= 990C50
reference_via_isbn= 999C5i
[...]
citation_loss_limit = 50
collections =

Then it was solved 🙂

Botón de flecha animada con CSS3

El otro día un amigo me pedía que metiera una flechita en movimiento en su web. Os dejo el ejemplo de cómo lo hice, por si os resulta útil. Para crear la flecha utilizo font-awesome 😉

1. En el MARCADO:

<span class="hero-btn-holder" style="">
   <a target="_blank" href="/#main-content" class="hero-btn hero-slider-button">
         <i style="color: #ffffff;" class="fa fa-angle-down fa-4x ut-service-box-icon"></i>
   </a>
</span>

2. En el CSS:

/* flecha abajo en movimiento */
/* buscamos el selector que sea la flecha (en este caso la selección está sacada de un theme de ejemplo) */
#ut-hero-captions > ul:nth-child(1) > li:nth-child(n) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > span:nth-child(2) > a:nth-child(1){
	cursor: pointer;
	-webkit-animation: jumpInc 2s infinite;
       -moz-animation: jumpInc 2s infinite;
         -o-animation: jumpInc 2s infinite;
            animation: jumpInc 2s infinite;
}

@-webkit-keyframes jumpInc {
	0%   {
		margin-top: -122%;
		opacity: 0;
	}
	50%  {
		margin-top: 0%;
		opacity: 1;
	}
	100% {
		margin-top: 122%;
		opacity: 0;
	}
}

@-moz-keyframes jumpInc {
	0%   {
		margin-top: -122%;
		opacity: 0;
	}
	50%  {
		margin-top: 0%;
		opacity: 1;
	}
	100% {
		margin-top: 122%;
		opacity: 0;
	}
}
@-o-keyframes jumpInc {
	0%   {
		margin-top: -122%;
		opacity: 0;
	}
	50%  {
		margin-top: 0%;
		opacity: 1;
	}
	100% {
		margin-top: 122%;
		opacity: 0;
	}
}
@keyframes jumpInc {
	0%   {
		margin-top: -122%;
		opacity: 0;
	}
	50%  {
		margin-top: 0%;
		opacity: 1;
	}
	100% {
		margin-top: 122%;
		opacity: 0;
	}
}

/* /flecha abajo */

[RESUELTO] Cómo cargar varios ficheros Javascript desde uno único

¿Cómo cargar varios archivos JS desde un JS único y ejecutar funciones de dentro?

Se puede hacer usando la llamada jQuery getScript, asi:

$.when(
    $.getScript( "/mypath/myscript1.js" ),
    $.getScript( "/mypath/myscript2.js" ),
    $.getScript( "/mypath/myscript3.js" ),
    $.Deferred(function( deferred ){    // esperar a que el DOM esté listo
        $( deferred.resolve );
    })
    ).done(function(){
          //poner aqui tu código. todos los scripts anteriores estarán cargados y listos para usarse
    });

Si no te funciona, asegúrate de que no hay errores de parsing en tus ficheros JS (prueba primero que se carguen bien metiéndolos en un tag <script>

jQuery.getScript() considerará errores de parsing un load fallido y se llamará fail() en vez de done()

(SOLVED) How to center div horizontally and vertically using jQuery

How to center a div horizontally and vertically, no matter if the browser screen is resized?

It is very easy with jQuery…

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="es" xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 	<meta http-equiv="Content-Language" content="es" />
 	<title>Center div horizontally and vertically</title>
 	<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
	<script type="text/javascript">
		jQuery.fn.center = function () {
    		  this.css("position","absolute");
    		  this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px");
    		  this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px");
    		return this;
		}
		$(window).load(function(){  
			$("#container").center();
		});
		$(window).resize(function(){
			$("#container").center();
		});
	</script>
</head>
<body>	
<div id="container">
	<span>Some content here</span>
</div>
</body>
</html>

Pasar de .mo a .pot y viceversa [RESUELTO]

Algo común cuando instalas un theme de WordPress es que en el path donde se encuentren las traducciones sólo tengas el archivo .mo correspondiente a tu idioma (y no el .po).

Los archivos .mo son binarios y no se pueden editar directamente. Asi que, ¿cómo modificar un archivo de traducción si no tienes el archivo .po correspondiente?

Fácil. En la página http://tools.konstruktors.com/ te ofrecen una herramienta online gratuita para realizar conversiones de .po a .mo y conversiones de .mo a .po

Si lo prefieres, también puedes instalar en tu equipo las gettext-tools y usar la herramienta msgunfmt.

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)