Entrades

Renda fixa

Índexs a tenir en compte: Euro Short-term rate : tipus mig ofert entre bancs i institucions financeres per a "grans" transaccions (overnight o diari). Euribor : (Euro Interbank Offered Rate): tipus mig en què els grans bancs europeus es deixen diners entre ells (de 1 setmana a 12 mesos) ECB interest rates : interès rebut pels bancs per tenir els teus diners dipositats al banc Tracte directe: Comptes remunerats (e.g ING cuenta naranja, trade republic) Dipòsit a plaç fix (e.g ofertat en la majoria de bancs) Lletres del tresor (3, 6, 9 i 12 mesos, directament al banc d'Espanya) Fons: Fons monetaris (Money market funds) - diari Ultra-short term bond  - 3 mesos Floating rate bond - 6 mesos Bons de curta durada - 1 a 3.5 anys Bons de mitja durada - 3.5 a 6 anys Bons més enllà dels 6 anys   Estratègies: Quan Euribor Baixa -> dispòsits a plaç fix llargs Quan Euribor puja -> dispòsits a plaç fix curts   Per a productes com fons monetaris, ultra-short term bonds, ... és neces...

Array of pointers in Fortran

In order to have an array of pointers use the following form: type(objectContainer), allocatable :: some(:) ... type objectContainer class(object), pointer :: toObj end type Do not fall into the mistake to use the form below as it is a pointer to an array class(object), pointer :: some(:) nor type(object), pointer :: some(:)

gFortran allocatable arrays and intrinsic all function

Be carefull when using allocatable arrays and all builtin method. The compiler is not able to detect the different sizes. So it provides a false positive when tested with the first value  of the array. Check below an example: program allbug implicit none real, allocatable :: values(:,:) allocate(values(3,1)) values(:, 1) = [26., 27., 28.] write(*,*) "values= ", values write(*,*) "the same vs 26?", all(values(:, 1) == [26.] ) write(*,*) "the same vs 27?", all(values(:, 1) == [27.] ) end program    The output: bash:~/projects$ ./a.out values= 26.0000000 27.0000000 28.0000000 the same vs 26? T <---- HERE! the same vs 27? F On the other hand, when it is done with an explicit array an error is raised at compilation time. all-fixed.f90:10:36-51: 10 | write(*,*) "the same vs 26?", all(values(:, 1) == [26.] ) | 1 2 Error: Shapes for operands at...

How to reinstall django 1.8 initial database configuration

Deal with the database: sudo su postgresql psql drop database somedatabase; CREATE DATABASE somenewdb OWNER geodjango TEMPLATE template_postgis ENCODING 'utf8'; \q exit export DJANGO_SETTINGS_MODULE='src.settings' Go to your src folder: ./manage makemigrations ./manage migrate ./manage.py loaddata initial-data-fixtures ./manage.py loaddata initial-data-consulta

Papi_avail for SandyBridge E5-2680

Available PAPI preset and user defined events plus hardware information. -------------------------------------------------------------------------------- PAPI Version             : 5.4.1.0 Vendor string and code   : GenuineIntel (1) Model string and code    : Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz (45) CPU Revision             : 6.000000 CPUID Info               : Family: 6  Model: 45  Stepping: 6 CPU Max Megahertz        : 2700 CPU Min Megahertz        : 1200 Hdw Threads per core     : 2 Cores per Socket         : 8 Sockets                  : 2 NUMA No...

Intel Basic assembly notation SIMD

  Loading movupd xmm0 ... (SSE move unaligned packed double into 128-bit ) vmovaps ymm0 ... (AVX move aligned packed single into 256-bit) Operating –vaddpd ymm1 ymm2 (AVX add packed double 256-bit) –addsd(SSE Add scalar doubles–SSE, but NOT vector op!) KEY – v = AVX – p, s = packed, scalar – u, a = unaligned, aligned – s, d = single, double Source: http://www.cac.cornell.edu/education/training/ParallelFall2012 /Vectorization.pdf

Intel Data Alignment

SSE2 16 Byte AVX 32 Bytes Xeon Phi 64 Bytes Alignment increases the efficiency of data loads and stores to and from the processor. When targeting the Intel® Supplemental Streaming Extensions 2 (Intel® SSE 2) platforms, use 16-byte alignment that facilitates the use of SSE-aligned load instructions. When targeting the Intel® Advanced Vector Extensions (Intel® AVX) instruction set, try to align data on a 32-byte boundary. (See Improving Performance by Aligning Data .) For Intel® Xeon Phi™ coprocessors, memory movement is optimal on 64-byte boundaries. (See Data Alignment to Assist Vectorization .) https://software.intel.com/en-us/articles/explicit-vector-programming-best-known-methods

Intel Data Alignment

SSE2 16 Byte AVX 32 Bytes Xeon Phi 64 Bytes Alignment increases the efficiency of data loads and stores to and from the processor. When targeting the Intel® Supplemental Streaming Extensions 2 (Intel® SSE 2) platforms, use 16-byte alignment that facilitates the use of SSE-aligned load instructions. When targeting the Intel® Advanced Vector Extensions (Intel® AVX) instruction set, try to align data on a 32-byte boundary. (See Improving Performance by Aligning Data .) For Intel® Xeon Phi™ coprocessors, memory movement is optimal on 64-byte boundaries. (See Data Alignment to Assist Vectorization .) https://software.intel.com/en-us/articles/explicit-vector-programming-best-known-methods

Python 2.7 Compile

How to compile Python with static and dynamic libraries in a custom folder with UTF-16 enabled. ./configure --prefix=$HOME/usr/local --enable-shared --enable-unicode=ucs4 --with-pydebug   Otherwise you could get the following exception explained below: http://docs.python.org/2.7/faq/extending.html#when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2

netCDF 4.3.0 with HDF4, HDF5 and parallel

The following arguments are required for netCDF in order to compile the code. This will allow the support of HDF4, HDF5 and parallel IO. Compile HDF4 - 4.2.9 ./configure --enable-shared --disable-netcdf --disable-fortran --prefix=/usr/local   Compile HDF5  - 1.8.11 CC=mpicc ./configure --enable-parallel --prefix=/usr/local --with-zlib=/usr/include --enable-hl --enable-shared Compile netCDF - 4.3.0 with HDF4 and HDF5 with parallel CPPFLAGS="-I/usr/local/include -I/usr/include/hdf" CXXFLAGS=-I"/usr/local/include -I/usr/include/hdf" FFFLAGS="-I/usr/local/include -I/usr/include/hdf" FCFLAGS="-I/usr/local/include -I/usr/include/hdf" LDFLAGS=-L/usr/local/lib FC=mpif90 CXX=mpicxx CC=mpicc ./configure --enable-hdf4 --enable-netcdf4 --enable-shared --enable-dap

Prolog Random

Petita nota de com cridar a la funció random amb Prolog: A is random(23). Enllaç a la doc

jQuery datepicker validation

És possible que la validació del datepicker de jQuery et doni error pels navegadors basats en el webkit -Chrome, Safari, ...-. Sembla ser que aquests navegadors agafen el dia com a mes i el mes com a dia, sent el format com a DD/MM/AAAA. Per solucionar aquest problema he fet el següent: Modificar el fitxer jquery.validation.js on hi diu:   date: function(value, element) { return this.optional(element) || Invalid|NaN/.test(new Date(value)); }, i canviar-ho per: date: function(value, element) { return this.optional(element) || /^\d{2}[\/-]\d{2}[\/-]\d{4}$/.test(value); }, Ara la validació la fa amb expressions regulars i comprovant-ho amb el Google Chrome funciona corretament.
Amb la següent comanda s'esborren els fitxers amb l'extensió pyc tant a la carpeta on s'executa com en subdirectoris. find -name "*.pyc" -delete

Django Integrity Error amb loaddata

Si fent una importació de dades amb Django mitjançant la comanda:   ./manage.py loaddata i us apareix el següent error: IntegrityError : duplicate key value violates unique constraint "django_content_type_app_label_key" The problem is simply that you're getting the content types defined twice - once when you do syncdb , and once from the exported data you're trying to import. Since you may well have other items in your database that depend on the original content type definitions, I would recommend keeping those. So, after running syncdb , do manage.py dbshell and in your database do TRUNCATE django_content_type; to remove all the newly-defined content types. Then you shouldn't get any conflicts - on that part of the process, in any case. Resposta Original (Stackoverflow)

Recuperar Grub amb USB i Ubuntu 9.10

Aquestes són les comandes que cal escriure a consola per tal de restaurar el vostre GRUB. Aquestes s'executen des d'un USB drive amb la versió de l'ubuntu 9.10. La única cosa que us cal saber és on teniu la vostra partició linux. Per això heu d'executar fdisk -l que us retornarà la següent sortida. Dispositiu Arrenc. Inici Final Blocs Id Sistema /dev/sda1 1 5 40131 de BLA BLA BLA /dev/sda2 * 6 1918 15360000 7 HPFS/NTFS /dev/sda3 1918 45504 350105397+ 7 HPFS/NTFS /dev/sda4 45505 60801 122873152+ 5 Estesa /dev/sda5 45505 46354 6827593+ 82 Intercanvi Linux / Solaris /dev/sda6 46355 60801 116045496 83 Linux Aleshores fixeu-vos amb el camp Dispositiu Arrenc. i que es correspongui amb Sistema = Linux. En el nostre cas /dev/sda6 . Després feu servir aquesta informació amb la tal i com veieu a baix: sudo su mount /dev/...

Europa del S.0 al S. XX cada 100 anys GIF

Imatge
Aquí us deixo l'enllaça a la pàgina original on hi han tots els mapes cada 100 anys: enllaç

Django + Postgres: duplicate key value violates unique constraint

Aquesta entrada tracta d'un problema que et pot aparèixer quan importes una taula amb valors ja creats. Aleshores et trobes que la clau que assigna els nous identificadors(AUTOINCREMENT o SERIAL) no es reactualitza i, per tant, apareix l'error esmentat. Per tal de solucionar-ho has de seguir aquests tres passos: //Consultem el valor més alt de la taula SELECT MAX ( id ) FROM la_teva_taula ; //mirem quin és el següent valor que pendria una nova entrada SELECT nextval ( 'la_teva_taula_id_seq' ); //assignem el nou valor amb el màxim vist més una unitat per tal d'evitar col·lisió amb l'últim element afegit SELECT setval ( ' la_teva_taula _id_seq' , ( SELECT MAX ( id ) FROM la_teva_taula )+ 1 );

Netejar el disc dur amb Linux

Si per motius de seguretat et cal netejar el disc dur el Linux ofereix la eina dd . Aquestes són les comandes bàsiques: Per escriure zeros tant al MBR com al disc dur: dd if=/dev/zero of=/dev/sda bs=1M Si encara vols que sigui més segur pots escriure dades aleatòriament en comptes de zeros: dd if=/dev/urandom of=/dev/sda bs=1M

Purchasing Power of Europe

Imatge
Trobat al fòrum de http://www.Skyscrapercity.com : Interessant mapa de les regions europees indicant la "riquesa" relativa de cada regió. Tot i que potser conté alguns errors no deixa de ser una bona referència.

Comandes MySQL

Un grapat de comanades bàsiques per operar amb el servidor SQL Connectar-se amb l'usuari indicat(-u) i indicar la contrassenya just després(-p): mysql -u -p Seleccionar una Base de Dades: use ; Mostrar les taules de la Base de Dades: show tables; Mostrar les comandes sql que s'utilitzarien per crear la taula escollida: show create table ; Eliminar claus de la taula: alter table drop key ; Eliminar claus forànies d'una taula: alter table drop foreign key ;